aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/processes.php
blob: a35800b82175d82c9af271b53e520a97e60ada53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php

# Collectd CPU plugin

require_once 'conf/common.inc.php';
require_once 'type/GenericStacked.class.php';

## LAYOUT
# processes/
# processes/ps_state-paging.rrd
# processes/ps_state-blocked.rrd
# processes/ps_state-zombies.rrd
# processes/ps_state-stopped.rrd
# processes/ps_state-running.rrd
# processes/ps_state-sleeping.rrd

$obj = new Type_GenericStacked($CONFIG, $_GET);
$obj->rrd_format = '%5.1lf%s';

switch($obj->args['type'])
{
	case 'ps_state':
		$obj->ds_names = array(
			'paging' => 'Paging',
			'blocked' => 'Blocked',
			'zombies' => 'Zombies',
			'stopped' => 'Stopped',
			'running' => 'Running',
			'sleeping' => 'Sleeping',
		);
		$obj->colors = array(
			'paging' => 'ffb000',
			'blocked' => 'ff00ff',
			'zombies' => 'ff0000',
			'stopped' => 'a000a0',
			'running' => '00e000',
			'sleeping' => '0000ff',
			'value' => 'f0a000',
		);
		$obj->rrd_title = 'Processes';
		$obj->rrd_vertical = 'Processes';
	break;

	case 'fork_rate':
		$obj->ds_names = array(
			'value' => 'Forks',
		);
		$obj->colors = array(
			'value' => 'f0a000',
		);
		$obj->rrd_title = 'Fork rate';
		$obj->rrd_vertical = 'forks/s';
	break;

	case 'ps_code':
		$obj->ds_names = array(
			'value' => 'TRS',
		);
		$obj->colors = array(
			'value' => '0000ff',
		);
		$obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes';
	break;

	case 'ps_count':
		$obj->data_sources = array('processes', 'threads');
		$obj->ds_names = array(
			'processes' => 'Processes',
			'threads' => 'Threads',
		);
		$obj->colors = array(
			'processes' => '0000ff',
			'threads' => 'ff0000',
		);
		$obj->rrd_title = sprintf('Number of Processes/Threads (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Amount';
	break;

	case 'ps_cputime':
		$obj->data_sources = array('user', 'syst');
		$obj->ds_names = array(
			'user' => 'User',
			'syst' => 'System',
		);
		$obj->colors = array(
			'user' => '0000ff',
			'syst' => 'ff0000',
		);
		$obj->rrd_title = sprintf('CPU time (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'CPU time [s]';
	break;

	case 'ps_disk_octets':
		$obj->data_sources = array('read', 'write');
		$obj->ds_names = array(
			'read'  => 'Read',
			'write' => 'Write',
		);
		$obj->colors = array(
			'read' => '0000ff',
			'write' => '00b000',
		);
		$obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes per second';
	break;

	case 'ps_disk_ops':
		$obj->data_sources = array('read', 'write');
		$obj->ds_names = array(
			'read'  => 'Read',
			'write' => 'Write',
		);
		$obj->colors = array(
			'read' => '0000ff',
			'write' => '00b000',
		);
		$obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Ops per second';
	break;

	case 'ps_data':
		$obj->ds_names = array(
			'value' => 'DRS',
		);
		$obj->colors = array(
			'value' => '0000ff',
		);
		$obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes';
	break;

	case 'ps_pagefaults':
		$obj->data_sources = array('minflt', 'majflt');
		$obj->ds_names = array(
			'minflt' => 'Minor',
			'majflt' => 'Major',
		);
		$obj->colors = array(
			'minflt' => 'ff0000',
			'majflt' => '0000ff',
		);
		$obj->rrd_title = sprintf('PageFaults (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Pagefaults';
	break;

	case 'ps_rss':
		$obj->ds_names = array(
			'value' => 'RSS',
		);
		$obj->colors = array(
			'value' => '0000ff',
		);
		$obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes';
	break;

	case 'ps_stacksize':
		$obj->ds_names = array(
			'value' => 'Stacksize',
		);
		$obj->colors = array(
			'value' => '0000ff',
		);
		$obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes';
	break;

	case 'ps_vm':
		$obj->ds_names = array(
			'value' => 'Memory',
		);
		$obj->colors = array(
			'value' => '0000ff',
		);
		$obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes';
	break;

}


$obj->rrd_graph();