#!/usr/bin/env php '1') { $errored[] = generate_device_link($interface, $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta']); $errored++; } $i++; } echo("Checked $i interfaces\n"); if (is_array($errored)) { ## If there are errored ports $i = 0; $msg = "Interfaces with errors : \n\n"; foreach ($errored as $int) { $msg .= "$int\n"; ## Add a line to the report email warning about them $i++; } ## Send the alert email notify($device, "Observium detected errors on $i interface" . ($i != 1 ? 's' : ''), $msg); } echo("$errored interfaces with errors over the past 5 minutes.\n"); ?>