From aa5760ae84068af1305a427cc72832302cfb801e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 25 Apr 2018 11:24:38 +0200 Subject: [PATCH] WIP: sysutils/nut: Add diagnostics (#657) --- sysutils/nut/Makefile | 2 +- .../OPNsense/Nut/Api/ServiceController.php | 16 ++++++++++++++-- .../mvc/app/models/OPNsense/Nut/Menu/Menu.xml | 5 +---- .../mvc/app/views/OPNsense/Nut/index.volt | 15 +++++++++++++++ .../service/conf/actions.d/actions_nut.conf | 2 +- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile index 9a21905ea..65c28e040 100644 --- a/sysutils/nut/Makefile +++ b/sysutils/nut/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= nut -PLUGIN_VERSION= 0.4 +PLUGIN_VERSION= 0.5 PLUGIN_COMMENT= Network UPS Tools PLUGIN_DEPENDS= nut PLUGIN_MAINTAINER= m.muenz@gmail.com diff --git a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php index f96ad5b74..89bf1c414 100644 --- a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php +++ b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/ServiceController.php @@ -1,7 +1,7 @@ object(); + $host = "127.0.0.1"; + if (!empty((string)$cnf->netclient->address)) { + $host = (string)$cnf->netclient->address; + } + $upsname = "UPSName"; + if (!empty((string)$cnf->general->name)) { + $upsname = (string)$cnf->general->name; + } + $ups = $upsname . '@' . $host; $backend = new Backend(); - $response = $backend->configdRun("nut upsstatus"); + $response = $backend->configdpRun("nut upsstatus", array($ups)); return array("response" => $response); } } diff --git a/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Menu/Menu.xml b/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Menu/Menu.xml index 0f9883948..aa44febc2 100644 --- a/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Menu/Menu.xml +++ b/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Menu/Menu.xml @@ -1,8 +1,5 @@ - - - - + diff --git a/sysutils/nut/src/opnsense/mvc/app/views/OPNsense/Nut/index.volt b/sysutils/nut/src/opnsense/mvc/app/views/OPNsense/Nut/index.volt index a820004b0..b7caa9482 100644 --- a/sysutils/nut/src/opnsense/mvc/app/views/OPNsense/Nut/index.volt +++ b/sysutils/nut/src/opnsense/mvc/app/views/OPNsense/Nut/index.volt @@ -26,6 +26,14 @@ #}