if($rate_total == $crit){ #Add in flap detection, also, if an interface is down check x4 #before alarming. $stat = "DOWN"; append_log ("CRITICAL: Interface $int_table{$key} is DOWN.\n"); append_status("CRITICAL: Interface $int_table{$key} is DOWN.\n"); my $sth = $dbh->prepare("SELECT interface_status FROM device_iface_cache WHERE interface_name=? and hostname=?"); $sth->execute($int_table{key}, $host); #my $current_status = $dbh->prepare("SELECT interface_status FROM device_iface_cache WHERE interface_name='$int_table{$key}' and hostname='$host';"); #$current_status->execute; my ($f5_iface_status); $f5_iface_status=$sth->fetchrow_hashref(); #print "$f5_iface_status->{interface_status}\n"; if($f5_iface_status->{interface_status} ne $stat) { #my $iface_result = $dbh->prepare("UPDATE device_iface_cache SET interface_status='$stat', lastcheck='$date', hostname='$host' WHERE hostname='$host' AND interface_name='$int_table{$key}';"); #$iface_result->execute(); my $iface_result = $dbh->prepare("UPDATE device_iface_cache SET interface_status=?, lastcheck=? WHERE hostname=? AND interface_name=?"); $iface_result->execute($stat, $date, $host, $int_table{$key}); append_log ("STATUS CHANGED: Interface $int_table{$key} Was: $f5_iface_status->{interface_status} ------- Now: $stat\n"); } my $result = $dbh->prepare("UPDATE device_iface_cache SET interface_status=?, lastcheck=? WHERE hostname=? AND interface_name=?"); $result->execute($stat, $date, $host, $int_table{$key}); }