banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Network

banshee/network-collection/network/icmp/

ping

Whether a host answers ping, its packet loss and its average response time, to see a host down or a link that drops.

  • network
  • icmp
  • ping
  • availability
  • latency
  • loss

by banshee1 installation2 versions

Keen 1.0.0 · 19 lines
// Whether a host answers ping, and how fast: the poller sends ICMP echo requests to the address of the host
// and counts the replies. How many, how long each is awaited and how far apart they leave are settings of
// the tree (protocol:icmp:count, protocol:icmp:timeout, protocol:icmp:interval).
// No reply at all is the case this collector is for: the host is down, or cut off from the poller. It says
// so as critical, never as unreachable, and without a response time it could not give.
need('protocol:icmp');

output('loss', 'number', array('label' => 'Packet loss', 'unit' => '%'));
output('response-time', 'number', array('label' => 'Average response time', 'unit' => 'ms'));

watch.above('loss', 'Packet loss', 'loss', array('warning' => 20));
watch.above('slow', 'Slow replies', 'response-time', array('warning' => 200, 'critical' => 500, 'enabled' => false));

$ping = icmp.ping();
if ($ping['received'] == 0) {
    fail('critical', 'Host down', 'No reply to ' . $ping['sent'] . ' echo requests sent to ' . $ping['address']);
}
value('loss', $ping['loss']);
value('response-time', $ping['rtt_avg']);