diff options
Diffstat (limited to 'inc/collectd.inc.php')
-rw-r--r-- | inc/collectd.inc.php | 13 |
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 | ||
122 | function 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 |
123 | function graphs_from_plugin($host, $plugin) { | 135 | function 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; |