Hi All,
This may be not be directly related to this exact requirement, but might be helpful.
We had a slightly different requirement, i.e., to check whether every device is live or not ( in terms of ping reachability )
at a shorter interval than 5 minutes of observium's normal polling cycle.
Hence we developed the following script ( in fact customized the script found under the "attic" directory of the observium distribution. )
and is separately being executed as a cron job like the other poller observium scripts but at one minute interval and it will just update observium database about the device status.
We also set the refresh interval of the front page to 60 seconds ( default 500 seconds ) so that we get alerts ( alert boxes ) on the
front panel ( this can be simply extended to other alert mechanisms )
The normal observium polling does the full snmp parameter discorvery/polling in the normal way and populate the database as it is at the normal 5 minute interval and we did not change or touch any of those scripts and we are happy with 5 minute interval for other parameters checking.
But for your requirement, in addition to this you might also need to find a way to add devices to the observium without snmp :-)
cron:
*/1 * * * * root /opt/observium/poll-reachability.php >> /dev/null 2>&1
poll-reachability.php:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/env php
<?php
chdir(dirname($argv[0]));
include("includes/defaults.inc.php");
include("config.php");
include("includes/functions.php");
include("includes/definitions.inc.php");
$device_query = mysql_query("SELECT * FROM `devices` WHERE disabled = '0' ORDER BY `device_id` DESC");
if (!$device_query) {
die('Invalid query: ' . mysql_error());
}
while ($device = mysql_fetch_assoc($device_query))
{
$port = $device['port'];
echo($device['hostname']. " ");
if (isPingable($device['hostname']))
{
$status='1';
} else {
$status='0';
}
if ($status != $device['status'])
{
mysql_query("UPDATE `devices` SET `status`= '$status' WHERE `device_id` = '" . $device['device_id'] . "'");
if ($status == '1')
{
$stat = "Up";
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is up\n')");
if ($config['alerts']['email']['enable'])
{
notify($device, "Device Up: " . $device['hostname'], "Device Up: " . $device['hostname']);
}
} else {
$stat = "Down (ping)";
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('9', '" . $device['device_id'] . "', 'Device is down\n')");
if ($config['alerts']['email']['enable'])
{
notify($device, "Device Down: " . $device['hostname'], "Device Down: " . $device['hostname']);
}
}
log_event("Device status changed to $stat ", $device, strtolower($stat));
echo("Status Changed!\n");
}
}
?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With Best Regards, Supun Rathnayake Lanka communication Services (Pvt) Ltd. 65C, Dharmapala Mawatha, Colombo 07. Sri Lanka. Tel: +94-11-2437545 http://www.lankacom.net http://blog.lankacom.netOn 01/28/2014 05:44 PM, BERTRAND Adrien [BPCE Assurances] wrote:
Hum okay !
I’ll search something else or dev a little script :-)
Thanks,
Adrien Bertrand – Information Security Administrator
BPCE Assurances, 88 av de France 75013 Paris
De : observium [mailto:observium-bounces@observium.org] De la part de Tom Laermans
Envoyé : mardi 28 janvier 2014 12:38
À : Observium Network Observation System
Objet : Re: [Observium] New kind of device
Hi Adrien,
Support for non-SNMP devices is currently not planned.
Tom
On 01/28/2014 10:40 AM, BERTRAND Adrien [BPCE Assurances] wrote:Hi all !
I know that I ask about a lot of functionalities … but you like me for that :-)
So I’ll to be as clear as possible (and as “English” as possible …).
Is it possible to add a new kind of device that is only polled with ping ? The primary goal is to know when distant server (hosted by partners) aren’t reachable without asking to have access to their snmp daemon and community …
I imagine that it can be a huge work because it needs to bypass a lot of code but you could have think about it … ? To be simple for everyone, this kind of device can be a new sort of server but without any snmp information (no device panel / no ports panel, etc…) and just be polled by the ping. And when a hosts is down the alerter send a mail / trap and the index.php put an information box to warn on “device down” like any others hosts.
Sincerely,
Adrien Bertrand – Information Security Administrator
BPCE Assurances, 88 av de France 75013 Paris
_______________________________________________observium mailing listobservium@observium.orghttp://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium