aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/df.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/df.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 '')
-rw-r--r--plugin/df.php48
1 files changed, 0 insertions, 48 deletions
diff --git a/plugin/df.php b/plugin/df.php
deleted file mode 100644
index 2c0dfd8..0000000
--- a/plugin/df.php
+++ /dev/null
@@ -1,48 +0,0 @@
1<?php
2
3# Collectd Df plugin
4
5require_once 'conf/common.inc.php';
6require_once 'type/GenericStacked.class.php';
7
8# LAYOUT
9#
10# df-X/df_complex-free.rrd
11# df-X/df_complex-reserved.rrd
12# df-X/df_complex-used.rrd
13
14$obj = new Type_GenericStacked($CONFIG, $_GET);
15$obj->data_sources = array('value');
16$obj->order = array('reserved', 'free', 'used');
17$obj->legend = array(
18 'reserved' => 'Reserved',
19 'free' => 'Free',
20 'used' => 'Used',
21);
22$obj->colors = array(
23 'reserved' => 'aaaaaa',
24 'free' => '00ff00',
25 'used' => 'ff0000',
26);
27
28switch($obj->args['type']) {
29 case 'df_complex':
30 default:
31 $obj->rrd_title = sprintf('Free space (%s)', $obj->args['pinstance']);
32 $obj->rrd_vertical = 'Bytes';
33 $obj->rrd_format = '%5.1lf%sB';
34 break;
35 case 'df_inodes':
36 $obj->rrd_title = sprintf('Free inodes (%s)', $obj->args['pinstance']);
37 $obj->rrd_vertical = 'Inodes';
38 $obj->rrd_format = '%5.1lf%s';
39 break;
40}
41
42# backwards compatibility
43if ($CONFIG['version'] < 5) {
44 $obj->data_sources = array('free', 'used');
45 $obj->rrd_title = sprintf('Free space (%s)', $obj->args['tinstance']);
46}
47
48$obj->rrd_graph();