diff options
| author | Pim van den Berg | 2013-06-22 12:55:06 +0200 |
|---|---|---|
| committer | Pim van den Berg | 2013-06-22 12:55:06 +0200 |
| commit | 41a8b01c6dfb5e5660a7d0029338777d01019feb (patch) | |
| tree | abaec0eb770939b3d2396129e27c4ef3704ad925 /inc/html.inc.php | |
| parent | start using fieldset + legend for showing data (diff) | |
| download | apt-panopticon_cgp-41a8b01c6dfb5e5660a7d0029338777d01019feb.zip apt-panopticon_cgp-41a8b01c6dfb5e5660a7d0029338777d01019feb.tar.gz apt-panopticon_cgp-41a8b01c6dfb5e5660a7d0029338777d01019feb.tar.bz2 apt-panopticon_cgp-41a8b01c6dfb5e5660a7d0029338777d01019feb.tar.xz | |
overview: add color to load averages
The load average number turns:
* orange
When the load is higher than the number of cpu cores.
* red
When the load is more than twice as high as the number of cpu cores.
Diffstat (limited to '')
| -rw-r--r-- | inc/html.inc.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/inc/html.inc.php b/inc/html.inc.php index 0a33da5..015225e 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
| @@ -173,6 +173,8 @@ function host_summary($cat, $hosts) { | |||
| 173 | foreach($hosts as $host) { | 173 | foreach($hosts as $host) { |
| 174 | $host_counter++; | 174 | $host_counter++; |
| 175 | 175 | ||
| 176 | $cores = count(group_plugindata(collectd_plugindata($host, 'cpu'))); | ||
| 177 | |||
| 176 | printf('<tr class="%s">', $row_style[$host_counter % 2]); | 178 | printf('<tr class="%s">', $row_style[$host_counter % 2]); |
| 177 | printf('<th><a href="%shost.php?h=%s">%s</a></th>', | 179 | printf('<th><a href="%shost.php?h=%s">%s</a></th>', |
| 178 | $CONFIG['weburl'],$host, $host); | 180 | $CONFIG['weburl'],$host, $host); |
| @@ -189,10 +191,15 @@ function host_summary($cat, $hosts) { | |||
| 189 | isset($rrd_info['ds[midterm].last_ds']) && | 191 | isset($rrd_info['ds[midterm].last_ds']) && |
| 190 | isset($rrd_info['ds[longterm].last_ds'])) { | 192 | isset($rrd_info['ds[longterm].last_ds'])) { |
| 191 | 193 | ||
| 192 | printf('<td>%.2f</td><td>%.2f</td><td>%.2f</td>', | 194 | foreach (array('ds[shortterm].last_ds', 'ds[midterm].last_ds', 'ds[longterm].last_ds') as $info) { |
| 193 | $rrd_info['ds[shortterm].last_ds'], | 195 | $class = ''; |
| 194 | $rrd_info['ds[midterm].last_ds'], | 196 | if ($cores > 0 && $rrd_info[$info] > $cores * 2) |
| 195 | $rrd_info['ds[longterm].last_ds']); | 197 | $class = ' class="crit"'; |
| 198 | elseif ($cores > 0 && $rrd_info[$info] > $cores) | ||
| 199 | $class = ' class="warn"'; | ||
| 200 | |||
| 201 | printf('<td%s>%.2f</td>', $class, $rrd_info[$info]); | ||
| 202 | } | ||
| 196 | } | 203 | } |
| 197 | } | 204 | } |
| 198 | 205 | ||
