aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/ntpd.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/plugin/ntpd.php b/plugin/ntpd.php
new file mode 100644
index 0000000..1aae16c
--- /dev/null
+++ b/plugin/ntpd.php
@@ -0,0 +1,53 @@
1<?php
2
3# Collectd NTPD plugin
4
5require_once 'conf/common.inc.php';
6require_once 'type/Default.class.php';
7require_once 'inc/collectd.inc.php';
8
9## LAYOUT
10# ntpd/
11# ntpd/delay-<host>.rrd
12# ntpd/frequency_offset-loop.rrd
13# ntpd/time_dispersion-<host>.rrd
14# ntpd/time_offset-<host>.rrd
15
16$obj = new Type_Default($CONFIG);
17$obj->ds_names = array('ping' => 'Ping time',
18 'ping_stddev' => 'Ping stddev',
19 'ping_droprate' => 'Ping droprate');
20$obj->width = $width;
21$obj->heigth = $heigth;
22$obj->generate_colors();
23switch($obj->args['type']) {
24 case 'delay':
25 $obj->data_sources = array('seconds');
26 $obj->rrd_title = sprintf('Delay');
27 $obj->rrd_vertical = 'Seconds';
28 $obj->rrd_format = '%5.1lf%s';
29 break;
30 case 'frequency_offset':
31 $obj->data_sources = array('ppm');
32 $obj->rrd_title = 'Frequency offset';
33 $obj->rrd_vertical = 'ppm';
34 $obj->rrd_format = '%5.1lf%s';
35 break;
36 case 'time_dispersion':
37 $obj->data_sources = array('seconds');
38 $obj->rrd_title = 'Time dispersion';
39 $obj->rrd_vertical = 'Seconds';
40 $obj->rrd_format = '%5.1lf%s';
41 break;
42 case 'time_offset':
43 $obj->data_sources = array('seconds');
44 $obj->rrd_title = 'Time offset';
45 $obj->rrd_vertical = 'Seconds';
46 $obj->rrd_format = '%5.1lf%s';
47 break;
48}
49
50collectd_flush($obj->identifiers);
51$obj->rrd_graph();
52
53?>