aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/vserver.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugin/vserver.php187
1 files changed, 93 insertions, 94 deletions
diff --git a/plugin/vserver.php b/plugin/vserver.php
index e51d97d..204134e 100644
--- a/plugin/vserver.php
+++ b/plugin/vserver.php
@@ -28,110 +28,109 @@ require_once 'inc/collectd.inc.php';
28$obj = new Type_Default($CONFIG); 28$obj = new Type_Default($CONFIG);
29 29
30switch($obj->args['type']) { 30switch($obj->args['type']) {
31 case 'load': 31 case 'load':
32 require_once "plugin/load.php"; 32 require_once "plugin/load.php";
33 break; 33 break;
34 case 'vs_memory': 34 case 'vs_memory':
35 $obj = new Type_GenericStacked($CONFIG); 35 $obj = new Type_GenericStacked($CONFIG);
36 $obj->order = array('vm', 'vml', 'rss', 'anon'); 36 $obj->order = array('vm', 'vml', 'rss', 'anon');
37 # http://oldwiki.linux-vserver.org/Memory+Allocation 37 # http://oldwiki.linux-vserver.org/Memory+Allocation
38 $obj->ds_names = array( 38 $obj->ds_names = array(
39 'vm' => "Virtual memory pages", 39 'vm' => "Virtual memory pages",
40 'vml' => "Pages locked into memory", 40 'vml' => "Pages locked into memory",
41 'rss' => "Resident set size", 41 'rss' => "Resident set size",
42 'anon' => "Anonymous memory pages", 42 'anon' => "Anonymous memory pages",
43 ); 43 );
44 $obj->colors = array( 44 $obj->colors = array(
45 'vm' => '00e000', 45 'vm' => '00e000',
46 'vml' => '0000ff', 46 'vml' => '0000ff',
47 'rss' => 'ffb000', 47 'rss' => 'ffb000',
48 'anon' => 'ff00ff', 48 'anon' => 'ff00ff',
49 ); 49 );
50 $obj->width = $width; 50 $obj->width = $width;
51 $obj->heigth = $heigth; 51 $obj->heigth = $heigth;
52 52
53 $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']); 53 $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']);
54 $obj->rrd_vertical = ucfirst($CONFIG['datasize']); 54 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
55 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; 55 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
56 $obj->rrd_format = '%5.1lf%s'; 56 $obj->rrd_format = '%5.1lf%s';
57 57
58 collectd_flush($obj->identifiers); 58 collectd_flush($obj->identifiers);
59 $obj->rrd_graph(); 59 $obj->rrd_graph();
60 break; 60 break;
61 case 'vs_threads': 61 case 'vs_threads':
62 $obj = new Type_GenericStacked($CONFIG); 62 $obj = new Type_GenericStacked($CONFIG);
63 $obj->order = array('running', 'uninterruptable', 'onhold', 'total'); 63 $obj->order = array('running', 'uninterruptable', 'onhold', 'total');
64 # http://linux-vserver.org/ProcFS 64 # http://linux-vserver.org/ProcFS
65 $obj->ds_names = array( 65 $obj->ds_names = array(
66 'onhold' => "Number of threads on hold", 66 'onhold' => "Number of threads on hold",
67 'running' => "Number of running threads", 67 'running' => "Number of running threads",
68 'total' => "Total number of threads", 68 'total' => "Total number of threads",
69 'uninterruptable' => "Number of uninterruptible threads", 69 'uninterruptable' => "Number of uninterruptible threads",
70 ); 70 );
71 $obj->colors = array( 71 $obj->colors = array(
72 'onhold' => '00e000', 72 'onhold' => '00e000',
73 'running' => '0000ff', 73 'running' => '0000ff',
74 'total' => 'ffb000', 74 'total' => 'ffb000',
75 'uninterruptable' => 'ff00ff', 75 'uninterruptable' => 'ff00ff',
76 ); 76 );
77 $obj->width = $width; 77 $obj->width = $width;
78 $obj->heigth = $heigth; 78 $obj->heigth = $heigth;
79 79
80 $obj->rrd_title = sprintf('Threads on Vserver %s', $obj->args['pinstance']); 80 $obj->rrd_title = sprintf('Threads on Vserver %s', $obj->args['pinstance']);
81 $obj->rrd_vertical = 'Numbers'; 81 $obj->rrd_vertical = 'Numbers';
82 $obj->rrd_format = '%5.1lf%s'; 82 $obj->rrd_format = '%5.1lf%s';
83 83
84 collectd_flush($obj->identifiers); 84 collectd_flush($obj->identifiers);
85 $obj->rrd_graph(); 85 $obj->rrd_graph();
86 break; 86 break;
87 case 'if_octets': 87 case 'if_octets':
88 $obj->data_sources = array('rx', 'tx'); 88 $obj->data_sources = array('rx', 'tx');
89 $obj->ds_names = array( 89 $obj->ds_names = array(
90 'inet-rx' => 'IPv4 Receive', 90 'inet-rx' => 'IPv4 Receive',
91 'inet-tx' => 'IPv4 Transmit', 91 'inet-tx' => 'IPv4 Transmit',
92 'inet6-rx' => 'IPv6 Receive', 92 'inet6-rx' => 'IPv6 Receive',
93 'inet6-tx' => 'IPv6 Transmit', 93 'inet6-tx' => 'IPv6 Transmit',
94 ); 94 );
95 $obj->colors = array( 95 $obj->colors = array(
96 'inet-rx' => '0000ff', 96 'inet-rx' => '0000ff',
97 'inet-tx' => '00b000', 97 'inet-tx' => '00b000',
98 'inet6-rx' => 'e0e0e0', 98 'inet6-rx' => 'e0e0e0',
99 'inet6-tx' => 'ffb000', 99 'inet6-tx' => 'ffb000',
100 'other-rx' => 'ff00ff', 100 'other-rx' => 'ff00ff',
101 'other-tx' => 'a000a0', 101 'other-tx' => 'a000a0',
102 'unix-rx' => '00e000', 102 'unix-rx' => '00e000',
103 'unix-tx' => '0080ff', 103 'unix-tx' => '0080ff',
104 'unspec-rx' => 'ff0000', 104 'unspec-rx' => 'ff0000',
105 'unspec-tx' => '000080', 105 'unspec-tx' => '000080',
106 ); 106 );
107 $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']); 107 $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']);
108 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize'])); 108 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
109 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; 109 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
110 $obj->width = $width; 110 $obj->width = $width;
111 $obj->heigth = $heigth; 111 $obj->heigth = $heigth;
112 $obj->rrd_format = '%5.1lf%s'; 112 $obj->rrd_format = '%5.1lf%s';
113 113
114 collectd_flush($obj->identifiers); 114 collectd_flush($obj->identifiers);
115 $obj->rrd_graph(); 115 $obj->rrd_graph();
116 break; 116 break;
117 case 'vs_processes': 117 case 'vs_processes':
118 $obj->data_sources = array('value'); 118 $obj->data_sources = array('value');
119 $obj->ds_names = array( 119 $obj->ds_names = array(
120 'value' => 'Processes', 120 'value' => 'Processes',
121 ); 121 );
122 $obj->rrd_title = sprintf('Processes on Vserver %s', $obj->args['pinstance']); 122 $obj->rrd_title = sprintf('Processes on Vserver %s', $obj->args['pinstance']);
123 $obj->rrd_vertical = 'Processes'; 123 $obj->rrd_vertical = 'Processes';
124 124
125 $obj->width = $width; 125 $obj->width = $width;
126 $obj->heigth = $heigth; 126 $obj->heigth = $heigth;
127 $obj->rrd_format = '%5.1lf%s'; 127 $obj->rrd_format = '%5.1lf%s';
128 128
129 collectd_flush($obj->identifiers); 129 collectd_flush($obj->identifiers);
130 $obj->rrd_graph(); 130 $obj->rrd_graph();
131 break; 131 break;
132 132
133 default: 133 default:
134 die('Not implemented yet.'); 134 die('Not implemented yet.');
135 break; 135 break;
136} 136}
137?>