aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/ntpd.php
blob: 18187a94647dcb7fd7af31ad8c1e4f02c03093a2 (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
40
41
42
43
44
45
46
47
48
<?php

# Collectd NTPD plugin

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

## LAYOUT
# ntpd/
# ntpd/delay-<host>.rrd
# ntpd/frequency_offset-loop.rrd
# ntpd/time_dispersion-<host>.rrd
# ntpd/time_offset-<host>.rrd

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

switch($obj->args['type']) {
	case 'delay':
		$obj->data_sources = array('seconds');
		$obj->rrd_title = sprintf('Delay');
		$obj->rrd_vertical = 'Seconds';
		break;
	case 'frequency_offset':
		$obj->data_sources = array('ppm');
		$obj->rrd_title = 'Frequency offset';
		$obj->rrd_vertical = 'ppm';
		break;
	case 'time_dispersion':
		$obj->data_sources = array('seconds');
		$obj->rrd_title = 'Time dispersion';
		$obj->rrd_vertical = 'Seconds';
		break;
	case 'time_offset':
		$obj->data_sources = array('seconds');
		$obj->rrd_title = 'Time offset';
		$obj->rrd_vertical = 'Seconds';
		break;
}

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