mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
- 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:
@@ -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?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user