$voltage['sensor_limit_low'] && $volt <= $voltage['sensor_limit_low']) { if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'] . " is " . $volt . "V (Limit " . $voltage['sensor_limit']; $msg .= "V) at " . date($config['timestamp_format']); notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg); echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n"); log_event('Voltage ' . $voltage['sensor_descr'] . " under threshold: " . $volt . " V (< " . $voltage['sensor_limit_low'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']); } else if($voltage['sensor_current'] < $voltage['sensor_limit'] && $volt >= $voltage['sensor_limit']) { if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'] . " is " . $volt . "V (Limit " . $voltage['sensor_limit']; $msg .= "V) at " . date($config['timestamp_format']); notify($device, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg); echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n"); log_event('Voltage ' . $voltage['sensor_descr'] . " above threshold: " . $volt . " V (> " . $voltage['sensor_limit'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']); } mysql_query("UPDATE sensors SET sensor_current = '$volt' WHERE sensor_class='voltage' AND sensor_id = '" . $voltage['sensor_id'] . "'"); } ?>