2010-09-03 18:26:59 +00:00
|
|
|
#!/usr/bin/env php
|
2007-04-03 14:10:23 +00:00
|
|
|
<?php
|
|
|
|
|
2010-02-27 14:44:38 +00:00
|
|
|
include("includes/defaults.inc.php");
|
2007-04-03 14:10:23 +00:00
|
|
|
include("config.php");
|
|
|
|
include("includes/functions.php");
|
|
|
|
|
2007-11-23 11:37:28 +00:00
|
|
|
$alert_query = mysql_query("SELECT *, A.id as id FROM `alerts` as A, `devices` as D where A.device_id = D.device_id AND alerted = '0'");
|
2011-03-16 22:04:29 +00:00
|
|
|
while ($alert = mysql_fetch_array($alert_query))
|
|
|
|
{
|
2007-04-03 14:10:23 +00:00
|
|
|
$id = $alert['id'];
|
|
|
|
$host = $alert['hostname'];
|
|
|
|
$date = $alert['time_logged'];
|
|
|
|
$msg = $alert['message'];
|
|
|
|
$alert_text .= "$date $host $msg";
|
|
|
|
|
|
|
|
mysql_query("UPDATE `alerts` SET alerted = '1' WHERE `id` = '$id'");
|
|
|
|
}
|
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
if ($alert_text)
|
|
|
|
{
|
2007-04-03 14:10:23 +00:00
|
|
|
echo("$alert_text");
|
2009-04-23 21:13:56 +00:00
|
|
|
# `echo '$alert_text' | gnokii --sendsms <NUMBER>`;
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
?>
|