Posted: Tue Nov 27, 2007 1:18 pm Post subject: Interface errors report
While troubleshooting a problem with my mactrack install (just a device detection issue easily resolved) I noticed that there were fields for errors in the interfaces table. It occurred to me that this could be useful to generate reports of interface errors. Having the ability to look one place for most of the daily operational kinds of checks (in Cacti) would be nice. I took at look at the code and decided to have a go at it (see screenshot).
One thing I thought I'd like to take care of is to have a way to reset the error counters in the interface table if the counters on the device reset to zero or lower than what is in the table. I am considering modifying this section of mactrack_functions.php (line 462) to handle this:
/* see if error's or discards have been increating */
if (!isset($db_interface[$ifIndex]["ifInErrors"])) {
$int_errors_present = FALSE;
}else if (!isset($ifInErrors[$ifIndex])) {
$int_errors_present = FALSE;
}else if (!isset($ifOutErrors[$ifIndex])) {
$int_errors_present = FALSE;
}else if (($ifInErrors[$ifIndex] <> $db_interface[$ifIndex]["ifInErrors"]) ||
($ifOutErrors[$ifIndex] <> $db_interface[$ifIndex]["ifOutErrors"])) {
$int_errors_present = TRUE;
}else{
$int_errors_present = FALSE;
}
if (!isset($db_interface[$ifIndex]["ifInDiscards"])) {
$int_errors_present = FALSE;
}else if (!isset($ifInDiscards[$ifIndex])) {
$int_discards_present = FALSE;
}else if (!isset($ifOutDiscards[$ifIndex])) {
$int_discards_present = FALSE;
}else if (($ifInDiscards[$ifIndex] <> $db_interface[$ifIndex]["ifInDiscards"]) ||
($ifOutDiscards[$ifIndex] <> $db_interface[$ifIndex]["ifOutDiscards"])) {
$int_discards_present = TRUE;
}else{
$int_discards_present = FALSE;
}
Can you think of any reason I could not reset the values by changing the logic to detect when the device counters are lower than what is in the table?
I modified mactrack_view.php and created a new file called inc_mactrack_view_error_filter_table.php to implement this report. I basically just took sections of your existing code and modified it to generate the error report. If there is any interest in this I'll be happy to provide the modified files.
Posted: Fri Nov 30, 2007 12:46 pm Post subject: Answer my own (stupid) question
After a bit more review of the code and some reading I realize it was a stupid question. Never mind on that.
But, in case anyone else is interested the files to add the report to MAC Track 1.1 are in the attached zip file. I did modify mactrack_view.php in order to implement this.