- Send email alerts on interface flaps when $config['warn']['ifdown'] is true.

- Added the setting timestamp_format:
    Description: The timestamp format to use in logs or emails.
    Default:     d-m-Y H:i:s
- Modified timestamp dates.


git-svn-id: http://www.observium.org/svn/observer/trunk@952 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Geert Hauwaerts
2010-02-25 20:40:35 +00:00
parent dc04b5189b
commit 74235000be
8 changed files with 33 additions and 18 deletions
+14
View File
@@ -162,6 +162,20 @@
// End Update MySQL
unset($update_query); unset($update);
// Send alerts for interface flaps.
if ($config['warn']['ifdown'] && ($port['ifOperStatus'] != $this_port['ifOperStatus'])) {
if ($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
if ($this_port['ifAlias']) { $falias = preg_replace('/^"/', '', $this_port['ifAlias']); $falias = preg_replace('/"$/', '', $falias); $full = $this_port['ifDescr'] . " (" . $falias . ")"; } else { $full = $this_port['ifDescr']; }
switch ($this_port['ifOperStatus']) {
case "up":
mail($email, "Interface UP - " . $device['hostname'] . " - " . $full, "Device: " . $device['hostname'] . "\nInterface: " . $full . "\nTimestamp: " . date($config['timestamp_format']), $config['email_headers']);
break;
case "down":
mail($email, "Interface DOWN - " . $device['hostname'] . " - " . $full, "Device: " . $device['hostname'] . "\nInterface: " . $full . "\nTimestamp: " . date($config['timestamp_format']), $config['email_headers']);
break;
}
}
} else {
echo("Port Deleted?"); // Port missing from SNMP cache?
}