1 <?php // vim:fenc=utf-8:filetype=php:ts=4
3 * Copyright (C) 2009 Bruno Prémont <bonbons AT linux-vserver.org>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 function load_graph_definitions_local($logarithmic = false, $tinylegend = false) {
20 global $GraphDefs, $MetaGraphDefs;
22 // Define 1-rrd Graph definitions here
23 $GraphDefs['local_type'] = array(
25 'DEF:avg={file}:value:AVERAGE',
26 'DEF:min={file}:value:MIN',
27 'DEF:max={file}:value:MAX',
30 "LINE1:avg#0000FF:Commits",
31 'GPRINT:min:MIN:%6.1lf Min,',
32 'GPRINT:avg:AVERAGE:%6.1lf Avg,',
33 'GPRINT:max:MAX:%6.1lf Max,',
34 'GPRINT:avg:LAST:%6.1lf Last\l');
36 // Define MetaGraph definition type -> function mappings here
37 $MetaGraphDefs['local_meta'] = 'meta_graph_local';
40 function meta_graph_local($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
44 $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
45 if (!isset($opts['title']))
46 $opts['title'] = $title;
47 $opts['rrd_opts'] = array('-v', 'Events');
50 /* $opts['colors'] = array(
53 'malware' => '990000',
56 'deferred' => 'a0e000',
61 $type_instances = array('ham', 'spam', 'malware', 'sent', 'deferred', 'reject', 'bounced'); */
62 foreach ($type_instances as $inst) {
64 foreach ($config['datadirs'] as $datadir)
65 if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
66 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
72 $sources[] = array('name'=>$inst, 'file'=>$file);
75 // return collectd_draw_meta_stack($opts, $sources);
76 return collectd_draw_meta_line($opts, $sources);