File: definitions.local.php

package info (click to toggle)
collectd 5.12.0-27
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,160 kB
  • sloc: ansic: 120,848; perl: 20,684; php: 3,007; makefile: 2,441; java: 1,713; javascript: 920; python: 892; sh: 799; cpp: 638; yacc: 231; sql: 198; lex: 146; ruby: 49; xml: 44
file content (79 lines) | stat: -rw-r--r-- 2,526 bytes parent folder | download | duplicates (13)
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
<?php // vim:fenc=utf-8:filetype=php:ts=4
/*
 * Copyright (C) 2009  Bruno Prémont <bonbons AT linux-vserver.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; only version 2 of the License is applicable.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

function load_graph_definitions_local($logarithmic = false, $tinylegend = false) {
	global $GraphDefs, $MetaGraphDefs;

	// Define 1-rrd Graph definitions here
	$GraphDefs['local_type'] = array(
		'-v', 'Commits',
		'DEF:avg={file}:value:AVERAGE',
		'DEF:min={file}:value:MIN',
		'DEF:max={file}:value:MAX',
		"AREA:max#B7B7F7",
		"AREA:min#FFFFFF",
		"LINE1:avg#0000FF:Commits",
		'GPRINT:min:MIN:%6.1lf Min,',
		'GPRINT:avg:AVERAGE:%6.1lf Avg,',
		'GPRINT:max:MAX:%6.1lf Max,',
		'GPRINT:avg:LAST:%6.1lf Last\l');

	// Define MetaGraph definition type -> function mappings here
	$MetaGraphDefs['local_meta'] = 'meta_graph_local';
}

function meta_graph_local($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
	global $config;
	$sources = array();

	$title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
	if (!isset($opts['title']))
		$opts['title'] = $title;
	$opts['rrd_opts'] = array('-v', 'Events');

	$files = array();
/*	$opts['colors'] = array(
		'ham'     => '00e000',
		'spam'    => '0000ff',
		'malware' => '990000',

		'sent'     => '00e000',
		'deferred' => 'a0e000',
		'reject'   => 'ff0000',
		'bounced'  => 'a00050'
	);

	$type_instances = array('ham', 'spam', 'malware',  'sent', 'deferred', 'reject', 'bounced'); */
	foreach ($type_instances as $inst) {
		$file  = '';
		foreach ($config['datadirs'] as $datadir)
			if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
				$file = $datadir.'/'.$title.'-'.$inst.'.rrd';
				break;
			}
		if ($file == '')
			continue;

		$sources[] = array('name'=>$inst, 'file'=>$file);
	}

//	return collectd_draw_meta_stack($opts, $sources);
	return collectd_draw_meta_line($opts, $sources);
}

?>