diff options
author | Jared Dillard <jdillard@netgate.com> | 2016-07-19 11:24:37 -0500 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2016-07-19 13:30:11 -0300 |
commit | 340a5051e9aafc2cb6dc617938f12538cb5d4b51 (patch) | |
tree | 4c23308c968a6b8fd083d054ab412d68fa673a51 | |
parent | b477a8de4ebb45915691f5967166dcc28d6cf22a (diff) | |
download | FreeBSD-ports-340a5051e9aafc2cb6dc617938f12538cb5d4b51.zip FreeBSD-ports-340a5051e9aafc2cb6dc617938f12538cb5d4b51.tar.gz |
(Status > Monitoring) fix NTP graph error
-rw-r--r-- | sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php b/sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php index ca1510d..eeb8c8e 100644 --- a/sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php +++ b/sysutils/pfSense-Status_Monitoring/files/usr/local/www/rrd_fetch_json.php @@ -313,12 +313,23 @@ if ($left != "null") { } - $obj[$ds_key_left_adjusted]['min'] = min($stats); - $obj[$ds_key_left_adjusted]['max'] = max($stats); - $obj[$ds_key_left_adjusted]['avg'] = array_sum($stats) / count($stats); $obj[$ds_key_left_adjusted]['values'] = $data; $obj[$ds_key_left_adjusted]['raw'] = $raw_data; + if(count($stats)) { + + $obj[$ds_key_left_adjusted]['min'] = min($stats); + $obj[$ds_key_left_adjusted]['max'] = max($stats); + $obj[$ds_key_left_adjusted]['avg'] = array_sum($stats) / count($stats); + + } else { + + $obj[$ds_key_left_adjusted]['min'] = 0; + $obj[$ds_key_left_adjusted]['max'] = 0; + $obj[$ds_key_left_adjusted]['avg'] = 0; + + } + } } @@ -604,12 +615,23 @@ if ($right != "null") { } - $obj[$ds_key_right_adjusted]['min'] = min($stats); - $obj[$ds_key_right_adjusted]['max'] = max($stats); - $obj[$ds_key_right_adjusted]['avg'] = array_sum($stats) / count($stats); $obj[$ds_key_right_adjusted]['values'] = $data; $obj[$ds_key_right_adjusted]['raw'] = $raw_data; + if(count($stats)) { + + $obj[$ds_key_right_adjusted]['min'] = min($stats); + $obj[$ds_key_right_adjusted]['max'] = max($stats); + $obj[$ds_key_right_adjusted]['avg'] = array_sum($stats) / count($stats); + + } else { + + $obj[$ds_key_right_adjusted]['min'] = 0; + $obj[$ds_key_right_adjusted]['max'] = 0; + $obj[$ds_key_right_adjusted]['avg'] = 0; + + } + } } |