$voltage['volt_limit_low'] && $volt <= $voltage['volt_limit_low']) { if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'] . " is " . $volt . "V (Limit " . $voltage['volt_limit']; $msg .= "V) at " . date($config['timestamp_format']); mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'], $msg, $config['email_headers']); echo("Alerting for " . $device['hostname'] . " " . $voltage['volt_descr'] . "\n"); eventlog('Voltage ' . $voltage['volt_descr'] . " under threshold: " . $voltage['volt_current'] . " V (> " . $voltage['volt_limit'] . " V)", $device['device_id']); } else if($voltage['volt_current'] < $voltage['volt_limit'] && $volt >= $voltage['volt_limit']) { if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'] . " is " . $volt . "V (Limit " . $voltage['volt_limit']; $msg .= "V) at " . date($config['timestamp_format']); mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'], $msg, $config['email_headers']); echo("Alerting for " . $device['hostname'] . " " . $voltage['volt_descr'] . "\n"); eventlog('Voltage ' . $voltage['volt_descr'] . " above threshold: " . $voltage['volt_current'] . " V (> " . $voltage['volt_limit'] . " V)", $device['device_id']); } mysql_query("UPDATE voltage SET volt_current = '$volt' WHERE volt_id = '" . $voltage['volt_id'] . "'"); } ?>