Files
librenms-librenms/alerts.php
T

26 lines
636 B
PHP
Raw Normal View History

2010-09-03 18:26:59 +00:00
#!/usr/bin/env php
2007-04-03 14:10:23 +00:00
<?php
include("includes/defaults.inc.php");
2007-04-03 14:10:23 +00:00
include("config.php");
include("includes/functions.php");
$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
?>