forked from Cougar/mirror-observium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alerts.php
executable file
·39 lines (32 loc) · 847 Bytes
/
alerts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env php
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage alerts
* @author Adam Armstrong <[email protected]>
* @copyright (C) 2006 - 2013 Adam Armstrong
*
*/
include("includes/defaults.inc.php");
include("config.php");
include("includes/definitions.inc.php");
include("includes/functions.php");
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)
{
$id = $alert['id'];
$host = $alert['hostname'];
$date = $alert['time_logged'];
$msg = $alert['message'];
$alert_text .= "$date $host $msg";
dbUpdate(array('alerted' => '1'), 'alerts', '`id` = ?', array($id));
}
if ($alert_text)
{
echo("$alert_text");
# `echo '$alert_text' | gnokii --sendsms <NUMBER>`;
}
?>