From 01039a24a6cc88a828f20647ae6dda5ee15a0e09 Mon Sep 17 00:00:00 2001 From: Poil Date: Sun, 18 May 2014 12:28:34 +0200 Subject: Add base option (1GB=1024Mo) --- graph.php | 3 +++ plugin/df.json | 3 ++- type/Base.class.php | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/graph.php b/graph.php index be46653..fbc93a7 100644 --- a/graph.php +++ b/graph.php @@ -92,6 +92,9 @@ if (isset($plugin_json[$type]['datasize']) and $plugin_json[$type]['datasize']) if (isset($plugin_json[$type]['scale'])) $obj->scale = $plugin_json[$type]['scale']; +if (isset($plugin_json[$type]['base'])) + $obj->base = $plugin_json[$type]['base']; + if (isset($plugin_json[$type]['legend_format'])) $obj->rrd_format = $plugin_json[$type]['legend_format']; diff --git a/plugin/df.json b/plugin/df.json index 8820b89..ad345e4 100644 --- a/plugin/df.json +++ b/plugin/df.json @@ -17,7 +17,8 @@ "color": "ff0000" } }, - "legend_format": "%5.1lf%sB" + "legend_format": "%5.1lf%sB", + "base": "1024" }, "df_inodes": { "title": "Free inodes ({{PI}})", diff --git a/type/Base.class.php b/type/Base.class.php index 4cb9e18..40f3df0 100644 --- a/type/Base.class.php +++ b/type/Base.class.php @@ -17,6 +17,7 @@ class Type_Base { var $rrd_vertical; var $rrd_format = '%5.1lf%s'; var $scale = 1; + var $base; var $width; var $height; var $graph_type; @@ -253,6 +254,8 @@ class Type_Base { $rrdgraph[] = $this->rrdtool_opts; if ($this->graph_smooth) $rrdgraph[] = '-E'; + if ($this->base) + $rrdgraph[] = '--base '.$this->base; $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400); $rrdgraph[] = sprintf('-h %d', is_numeric($this->height) ? $this->height : 175); $rrdgraph[] = '-l 0'; -- cgit v1.1