aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/collectd.inc.php
diff options
context:
space:
mode:
authorPim van den Berg2011-12-03 17:14:51 +0100
committerPim van den Berg2011-12-03 17:14:51 +0100
commit89ef1de5efd305b9c3af9abd2f53aaff7c586ff3 (patch)
tree429ff28b53f10acce0627b7bd31b4b28680a085a /inc/collectd.inc.php
parentinclude trailing slash in config weburl variable (diff)
downloadapt-panopticon_cgp-89ef1de5efd305b9c3af9abd2f53aaff7c586ff3.zip
apt-panopticon_cgp-89ef1de5efd305b9c3af9abd2f53aaff7c586ff3.tar.gz
apt-panopticon_cgp-89ef1de5efd305b9c3af9abd2f53aaff7c586ff3.tar.bz2
apt-panopticon_cgp-89ef1de5efd305b9c3af9abd2f53aaff7c586ff3.tar.xz
order graphs by pi, t, ti
Diffstat (limited to '')
-rw-r--r--inc/collectd.inc.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php
index 439d507..d5a3d83 100644
--- a/inc/collectd.inc.php
+++ b/inc/collectd.inc.php
@@ -119,12 +119,25 @@ function group_plugindata($plugindata) {
119 return $data; 119 return $data;
120} 120}
121 121
122function plugin_sort($data) {
123 foreach ($data as $key => $row) {
124 $pi[$key] = $row['pi'];
125 $ti[$key] = $row['ti'];
126 $t[$key] = $row['t'];
127 }
128
129 array_multisort($pi, SORT_ASC, $t, SORT_ASC, $ti, SORT_ASC, $data);
130
131 return $data;
132}
133
122# generate graph url's for a plugin of a host 134# generate graph url's for a plugin of a host
123function graphs_from_plugin($host, $plugin) { 135function graphs_from_plugin($host, $plugin) {
124 global $CONFIG; 136 global $CONFIG;
125 137
126 $plugindata = collectd_plugindata($host, $plugin); 138 $plugindata = collectd_plugindata($host, $plugin);
127 $plugindata = group_plugindata($plugindata); 139 $plugindata = group_plugindata($plugindata);
140 $plugindata = plugin_sort($plugindata);
128 141
129 foreach ($plugindata as $items) { 142 foreach ($plugindata as $items) {
130 $items['h'] = $host; 143 $items['h'] = $host;