aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/nut/status_nut.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/nut/status_nut.php b/packages/nut/status_nut.php
index 14ba84f8..7bbba4c8 100644
--- a/packages/nut/status_nut.php
+++ b/packages/nut/status_nut.php
@@ -129,12 +129,14 @@ include("head.inc");
<td>
<table width="100%" class="tabcont" cellspacing="0" cellpadding="6">
<?php
- if($nut_config['monitor'] == 'local') {
- tblrow('Monitoring:','Local UPS');
- $handle = popen("upsc {$nut_config['name']}@localhost","r");
- } elseif($nut_config['monitor'] == 'remote') {
- tblrow('Monitoring:','Remote UPS');
- $handle = popen("upsc {$nut_config['remotename']}@{$nut_config['remoteaddr']}","r");
+ if((int)exec('pgrep upsmon | wc -l') > 0) {
+ if($nut_config['monitor'] == 'local') {
+ tblrow('Monitoring:','Local UPS');
+ $handle = popen("upsc {$nut_config['name']}@localhost","r");
+ } elseif($nut_config['monitor'] == 'remote') {
+ tblrow('Monitoring:','Remote UPS');
+ $handle = popen("upsc {$nut_config['remotename']}@{$nut_config['remoteaddr']}","r");
+ }
}
if($handle) {