aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/ping.php
blob: 58367036e16c9c377bf06c1f88df15fb0ae62b91 (plain)
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
<?php

# Collectd Ping plugin

require_once 'conf/common.inc.php';
require_once 'type/Default.class.php';
require_once 'inc/collectd.inc.php';

## LAYOUT
# ping/
# ping/ping-<host>.rrd
# ping/ping_stddev-<host>.rrd
# ping/ping_droprate-<host>.rrd

$obj = new Type_Default($CONFIG);
$obj->data_sources = array('value');
$obj->ds_names = array('ping' => 'Ping time',
                       'ping_stddev' => 'Ping stddev',
                       'ping_droprate' => 'Ping droprate');
$obj->rrd_format = '%5.1lf';

switch($obj->args['type']) {
	case 'ping':
		if ($CONFIG['version'] < 5)
			$obj->data_sources = array('ping');
		$obj->rrd_title = 'Ping latency';
		$obj->rrd_vertical = 'Milliseconds';
		break;
	case 'ping_stddev':
		$obj->rrd_title = 'Ping standard deviation';
		$obj->rrd_vertical = 'Milliseconds';
		break;
	case 'ping_droprate':
		$obj->rrd_title = 'Ping droprate';
		break;
}

collectd_flush($obj->identifiers);
$obj->rrd_graph();