aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/openvpn.php
diff options
context:
space:
mode:
authorConrad Kostecki2013-06-16 16:09:03 +0200
committerPim van den Berg2013-06-16 16:12:41 +0200
commit21cf80f378898265e239c3c444699669d71a0b36 (patch)
treedb83244f2e092b45788b8dc4e619891e315329d1 /plugin/openvpn.php
parentMerge pull request #10 from ConiKost/master (diff)
downloadapt-panopticon_cgp-21cf80f378898265e239c3c444699669d71a0b36.zip
apt-panopticon_cgp-21cf80f378898265e239c3c444699669d71a0b36.tar.gz
apt-panopticon_cgp-21cf80f378898265e239c3c444699669d71a0b36.tar.bz2
apt-panopticon_cgp-21cf80f378898265e239c3c444699669d71a0b36.tar.xz
plugin: add openvpn plugin
Source: http://pastebin.com/5vNDuKaZ
Diffstat (limited to 'plugin/openvpn.php')
-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();