aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/vserver.php
diff options
context:
space:
mode:
authorPim van den Berg2014-05-03 19:17:16 +0200
committerPim van den Berg2014-05-12 21:32:24 +0200
commit0a547add2f4cc264380d2dab2c472efe5a1d7094 (patch)
tree55bb43a3e31c5814848d61eea92c8438e4a37886 /plugin/vserver.php
parenttype/base: set default title to "Plugin Type (PluginInstance) (Category)" (diff)
downloadapt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.zip
apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.gz
apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.bz2
apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.xz
graph.php: use JSON plugins instead of including PHP plugin files
A couple of big changes here. A lot of logic moved to graph.php. The PHP plugin files have been rewritten to JSON. In these JSON files *everything* is optional. Also *NOT* having a JSON plugin file won't block you from having a graph. The JSON will just make the graphs prettier (by having a title, y-axis title, legend, colors, etc..). The Collectd types.db file is parsed and used to determine RRD content. When things are not defined in the JSON it will fallback to a default.
Diffstat (limited to 'plugin/vserver.php')
-rw-r--r--plugin/vserver.php122
1 files changed, 0 insertions, 122 deletions
diff --git a/plugin/vserver.php b/plugin/vserver.php
deleted file mode 100644
index 80fad3e..0000000
--- a/plugin/vserver.php
+++ /dev/null
@@ -1,122 +0,0 @@
1<?php
2
3# Collectd VServer plugin
4
5require_once 'conf/common.inc.php';
6require_once 'type/GenericIO.class.php';
7require_once 'type/GenericStacked.class.php';
8
9# LAYOUT
10# vserver-XXXX
11# vserver-XXXX/if_octets-inet6.rrd
12# vserver-XXXX/if_octets-inet.rrd
13# vserver-XXXX/if_octets-other.rrd
14# vserver-XXXX/if_octets-unix.rrd
15# vserver-XXXX/if_octets-unspec.rrd
16# vserver-XXXX/load.rrd
17# vserver-XXXX/vs_memory-anon.rrd
18# vserver-XXXX/vs_memory-rss.rrd
19# vserver-XXXX/vs_memory-vml.rrd
20# vserver-XXXX/vs_memory-vm.rrd
21# vserver-XXXX/vs_processes.rrd
22# vserver-XXXX/vs_threads-onhold.rrd
23# vserver-XXXX/vs_threads-running.rrd
24# vserver-XXXX/vs_threads-total.rrd
25# vserver-XXXX/vs_threads-uninterruptable.rrd
26
27$obj = new Type_Default($CONFIG, $_GET);
28
29switch($obj->args['type']) {
30 case 'load':
31 require_once "plugin/load.php";
32 break;
33 case 'vs_memory':
34 $obj = new Type_GenericStacked($CONFIG, $_GET);
35 $obj->order = array('vm', 'vml', 'rss', 'anon');
36 # http://oldwiki.linux-vserver.org/Memory+Allocation
37 $obj->legend = array(
38 'vm' => "Virtual memory pages",
39 'vml' => "Pages locked into memory",
40 'rss' => "Resident set size",
41 'anon' => "Anonymous memory pages",
42 );
43 $obj->colors = array(
44 'vm' => '00e000',
45 'vml' => '0000ff',
46 'rss' => 'ffb000',
47 'anon' => 'ff00ff',
48 );
49
50 $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']);
51 $obj->rrd_vertical = 'Bytes';
52 $obj->rrd_format = '%5.1lf%s';
53
54 $obj->rrd_graph();
55 break;
56 case 'vs_threads':
57 $obj = new Type_GenericStacked($CONFIG, $_GET);
58 $obj->order = array('running', 'uninterruptable', 'onhold', 'total');
59 # http://linux-vserver.org/ProcFS
60 $obj->legend = array(
61 'onhold' => "Number of threads on hold",
62 'running' => "Number of running threads",
63 'total' => "Total number of threads",
64 'uninterruptable' => "Number of uninterruptible threads",
65 );
66 $obj->colors = array(
67 'onhold' => '00e000',
68 'running' => '0000ff',
69 'total' => 'ffb000',
70 'uninterruptable' => 'ff00ff',
71 );
72
73 $obj->rrd_title = sprintf('Threads on Vserver %s', $obj->args['pinstance']);
74 $obj->rrd_vertical = 'Numbers';
75 $obj->rrd_format = '%5.1lf%s';
76
77 $obj->rrd_graph();
78 break;
79 case 'if_octets':
80 $obj->data_sources = array('rx', 'tx');
81 $obj->legend = array(
82 'inet-rx' => 'IPv4 Receive',
83 'inet-tx' => 'IPv4 Transmit',
84 'inet6-rx' => 'IPv6 Receive',
85 'inet6-tx' => 'IPv6 Transmit',
86 );
87 $obj->colors = array(
88 'inet-rx' => '0000ff',
89 'inet-tx' => '00b000',
90 'inet6-rx' => 'e0e0e0',
91 'inet6-tx' => 'ffb000',
92 'other-rx' => 'ff00ff',
93 'other-tx' => 'a000a0',
94 'unix-rx' => '00e000',
95 'unix-tx' => '0080ff',
96 'unspec-rx' => 'ff0000',
97 'unspec-tx' => '000080',
98 );
99 $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']);
100 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
101 $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
102 $obj->rrd_format = '%5.1lf%s';
103
104 $obj->rrd_graph();
105 break;
106 case 'vs_processes':
107 $obj->data_sources = array('value');
108 $obj->legend = array(
109 'value' => 'Processes',
110 );
111 $obj->rrd_title = sprintf('Processes on Vserver %s', $obj->args['pinstance']);
112 $obj->rrd_vertical = 'Processes';
113
114 $obj->rrd_format = '%5.1lf%s';
115
116 $obj->rrd_graph();
117 break;
118
119 default:
120 die('Not implemented yet.');
121 break;
122}