diff options
author | Pim van den Berg | 2010-01-12 20:35:45 +0100 |
---|---|---|
committer | Pim van den Berg | 2010-01-12 20:35:45 +0100 |
commit | cdfe601a3b2197ba33c29eeeee91d6820955078e (patch) | |
tree | bba5210fd0e1931789c37a0ddc7d4d7fa175d1df /inc | |
parent | show error when no hosts are found in datadir (diff) | |
download | apt-panopticon_cgp-cdfe601a3b2197ba33c29eeeee91d6820955078e.zip apt-panopticon_cgp-cdfe601a3b2197ba33c29eeeee91d6820955078e.tar.gz apt-panopticon_cgp-cdfe601a3b2197ba33c29eeeee91d6820955078e.tar.bz2 apt-panopticon_cgp-cdfe601a3b2197ba33c29eeeee91d6820955078e.tar.xz |
add compatibility if rrdinfo doesn't work as expected
Diffstat (limited to 'inc')
-rw-r--r-- | inc/html.inc.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/inc/html.inc.php b/inc/html.inc.php index 6ab84d9..c524e46 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
@@ -69,11 +69,25 @@ function host_summary($hosts) { | |||
69 | foreach($hosts as $host) { | 69 | foreach($hosts as $host) { |
70 | collectd_flush(sprintf('%s/load/load', $host)); | 70 | collectd_flush(sprintf('%s/load/load', $host)); |
71 | $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); | 71 | $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); |
72 | |||
73 | # ignore if file does not exist | ||
72 | if (!$rrd_info) | 74 | if (!$rrd_info) |
73 | continue; | 75 | continue; |
74 | printf('<tr><th><a href="%s/host.php?h=%s">%s</a></th><td>%.2f</td><td>%.2f</td><td>%.2f</td></tr>'."\n", | 76 | |
75 | $CONFIG['weburl'],$host, $host, | 77 | printf('<tr><th><a href="%s/host.php?h=%s">%s</a></th>', |
76 | $rrd_info["ds[shortterm].last_ds"], $rrd_info["ds[midterm].last_ds"], $rrd_info["ds[longterm].last_ds"]); | 78 | $CONFIG['weburl'],$host, $host); |
79 | |||
80 | if (isset($rrd_info['ds[shortterm].last_ds']) && | ||
81 | isset($rrd_info['ds[midterm].last_ds']) && | ||
82 | isset($rrd_info['ds[longterm].last_ds'])) { | ||
83 | |||
84 | printf('<td>%.2f</td><td>%.2f</td><td>%.2f</td>', | ||
85 | $rrd_info['ds[shortterm].last_ds'], | ||
86 | $rrd_info['ds[midterm].last_ds'], | ||
87 | $rrd_info['ds[longterm].last_ds']); | ||
88 | } | ||
89 | |||
90 | print "</tr>\n"; | ||
77 | } | 91 | } |
78 | 92 | ||
79 | echo "</table>\n"; | 93 | echo "</table>\n"; |