2010-09-03 18:26:59 +00:00
|
|
|
#!/usr/bin/env php
|
2007-04-03 14:10:23 +00:00
|
|
|
<?php
|
|
|
|
|
2012-05-09 10:01:42 +00:00
|
|
|
/**
|
2013-10-28 12:01:36 -07:00
|
|
|
* Observium
|
2012-05-09 10:01:42 +00:00
|
|
|
*
|
2013-10-28 12:01:36 -07:00
|
|
|
* This file is part of Observium.
|
2012-05-09 10:01:42 +00:00
|
|
|
*
|
2013-10-28 12:01:36 -07:00
|
|
|
* @package observium
|
|
|
|
* @subpackage alerts
|
|
|
|
* @author Adam Armstrong <adama@memetic.org>
|
|
|
|
* @copyright (C) 2006 - 2012 Adam Armstrong
|
2012-05-09 10:01:42 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-02-27 14:44:38 +00:00
|
|
|
include("includes/defaults.inc.php");
|
2007-04-03 14:10:23 +00:00
|
|
|
include("config.php");
|
2012-05-09 10:01:42 +00:00
|
|
|
include("includes/definitions.inc.php");
|
2007-04-03 14:10:23 +00:00
|
|
|
include("includes/functions.php");
|
|
|
|
|
2011-05-13 11:42:26 +00:00
|
|
|
foreach (dbFetchRows("SELECT *, A.id AS id FROM `alerts` AS A, `devices` AS D WHERE A.device_id = D.device_id AND alerted = '0'") as $alert)
|
2011-03-16 22:04:29 +00:00
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
$id = $alert['id'];
|
|
|
|
$host = $alert['hostname'];
|
|
|
|
$date = $alert['time_logged'];
|
|
|
|
$msg = $alert['message'];
|
|
|
|
$alert_text .= "$date $host $msg";
|
2007-04-03 14:10:23 +00:00
|
|
|
|
2014-02-22 15:47:57 +00:00
|
|
|
dbUpdate(array('alerted' => '1'), 'alerts', '`id` = ?', array($id));
|
2011-05-13 11:42:26 +00:00
|
|
|
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
if ($alert_text)
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
echo("$alert_text");
|
|
|
|
# `echo '$alert_text' | gnokii --sendsms <NUMBER>`;
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
|
|
|
|
2011-05-13 11:42:26 +00:00
|
|
|
?>
|