aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/openvpn.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugin/openvpn.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/plugin/openvpn.php b/plugin/openvpn.php
new file mode 100644
index 0000000..c146f10
--- /dev/null
+++ b/plugin/openvpn.php
@@ -0,0 +1,42 @@
1<?php
2
3# Collectd OpenVPN plugin
4
5require_once 'conf/common.inc.php';
6require_once 'inc/collectd.inc.php';
7
8## LAYOUT
9# openvpn-XXXX/
10# openvpn-XXXX/if_octets-XXXX.rrd
11# openvpn-XXXX/users-XXXX.rrd
12
13switch(GET('t')) {
14 case 'if_octets':
15 require_once 'type/GenericIO.class.php';
16 $obj = new Type_GenericIO($CONFIG);
17 $obj->ds_names = array(
18 'rx' => 'Receive',
19 'tx' => 'Transmit',
20 );
21 $obj->colors = array(
22 'rx' => '0000ff',
23 'tx' => '00b000',
24 );
25 $obj->rrd_title = sprintf('Traffic (%s)', $obj->args['pinstance']);
26 $obj->rrd_vertical = '%s per second';
27 $obj->rrd_format = '%5.1lf%s';
28 break;
29 case 'users':
30 require_once 'type/Default.class.php';
31 $obj = new Type_Default($CONFIG);
32 $obj->ds_names = array(
33 'value' => 'Users',
34 );
35 $obj->rrd_title = sprintf('Users (%s)', $obj->args['pinstance']);
36 $obj->rrd_vertical = 'Users';
37 $obj->rrd_format = '%.1lf';
38 break;
39}
40
41collectd_flush($obj->identifiers);
42$obj->rrd_graph();