From 6abffda11b173b59d8b820078cd204582acd5aef Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 5 Dec 2017 14:46:43 +0100 Subject: [PATCH] */*: merge @fraenki plugin modifications minus title removal --- net-mgmt/zabbix-agent/Makefile | 3 +-- .../src/etc/inc/plugins.inc.d/zabbixagent.inc | 2 +- .../OPNsense/ZabbixAgent/Api/ServiceController.php | 8 +++++++- .../mvc/app/views/OPNsense/ZabbixAgent/index.volt | 9 +++------ .../service/conf/actions.d/actions_zabbixagent.conf | 2 +- .../OPNsense/HAProxy/Api/ServiceController.php | 8 +++++++- .../opnsense/mvc/app/views/OPNsense/HAProxy/index.volt | 9 +++------ .../OPNsense/AcmeClient/Api/ServiceController.php | 8 +++++++- 8 files changed, 30 insertions(+), 19 deletions(-) diff --git a/net-mgmt/zabbix-agent/Makefile b/net-mgmt/zabbix-agent/Makefile index df5fdb1eb..d41d2a106 100644 --- a/net-mgmt/zabbix-agent/Makefile +++ b/net-mgmt/zabbix-agent/Makefile @@ -1,6 +1,5 @@ PLUGIN_NAME= zabbix-agent -PLUGIN_VERSION= 1.1 -PLUGIN_REVISION= 1 +PLUGIN_VERSION= 1.2 PLUGIN_COMMENT= Enterprise-class open source distributed monitoring agent PLUGIN_DEPENDS= zabbix34-agent PLUGIN_MAINTAINER= opnsense@moov.de diff --git a/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc b/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc index 709d9c49c..4fd006a4f 100644 --- a/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc +++ b/net-mgmt/zabbix-agent/src/etc/inc/plugins.inc.d/zabbixagent.inc @@ -58,7 +58,7 @@ function zabbixagent_services() } $services[] = array( - 'description' => gettext('Enterprise-class open source distributed monitoring agent'), + 'description' => gettext('Zabbix Agent'), 'pidfile' => '/var/run/zabbix/zabbix_agentd.pid', 'configd' => array( 'restart' => array('zabbix_agentd restart'), diff --git a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php index 35c66c70b..008956b17 100644 --- a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php +++ b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/controllers/OPNsense/ZabbixAgent/Api/ServiceController.php @@ -46,8 +46,10 @@ class ServiceController extends ApiControllerBase public function startAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); - $response = $backend->configdRun("zabbixagent start", true); + $response = $backend->configdRun("zabbixagent start"); return array("response" => $response); } else { return array("response" => array()); @@ -61,6 +63,8 @@ class ServiceController extends ApiControllerBase public function stopAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun("zabbixagent stop"); return array("response" => $response); @@ -76,6 +80,8 @@ class ServiceController extends ApiControllerBase public function restartAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun("zabbixagent restart"); return array("response" => $response); diff --git a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/views/OPNsense/ZabbixAgent/index.volt b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/views/OPNsense/ZabbixAgent/index.volt index fc5a8bf9f..23760f1df 100644 --- a/net-mgmt/zabbix-agent/src/opnsense/mvc/app/views/OPNsense/ZabbixAgent/index.volt +++ b/net-mgmt/zabbix-agent/src/opnsense/mvc/app/views/OPNsense/ZabbixAgent/index.volt @@ -71,12 +71,9 @@ POSSIBILITY OF SUCH DAMAGE. draggable: true }); } else { - // request service status after successful save and update status box (wait a few seconds before update) - setTimeout(function(){ - ajaxCall(url="/api/zabbixagent/service/status", sendData={}, callback=function(data,status) { - updateServiceStatusUI(data['status']); - }); - },3000); + ajaxCall(url="/api/zabbixagent/service/status", sendData={}, callback=function(data,status) { + updateServiceStatusUI(data['status']); + }); } }); }); diff --git a/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf b/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf index ec61e646b..7b902830f 100644 --- a/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf +++ b/net-mgmt/zabbix-agent/src/opnsense/service/conf/actions.d/actions_zabbixagent.conf @@ -17,7 +17,7 @@ type:script message:restarting zabbix_agentd [status] -command:/usr/local/etc/rc.d/zabbix_agentd status +command:/usr/local/etc/rc.d/zabbix_agentd status; exit 0 parameters: type:script_output message:requesting zabbix_agentd status diff --git a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php index 235e4aa5d..b6b1e7542 100644 --- a/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php +++ b/net/haproxy/src/opnsense/mvc/app/controllers/OPNsense/HAProxy/Api/ServiceController.php @@ -46,8 +46,10 @@ class ServiceController extends ApiControllerBase public function startAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); - $response = $backend->configdRun("haproxy start", true); + $response = $backend->configdRun("haproxy start"); return array("response" => $response); } else { return array("response" => array()); @@ -61,6 +63,8 @@ class ServiceController extends ApiControllerBase public function stopAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun("haproxy stop"); return array("response" => $response); @@ -76,6 +80,8 @@ class ServiceController extends ApiControllerBase public function restartAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun("haproxy restart"); return array("response" => $response); diff --git a/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt b/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt index 9750fc363..a2236bf27 100644 --- a/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt +++ b/net/haproxy/src/opnsense/mvc/app/views/OPNsense/HAProxy/index.volt @@ -352,12 +352,9 @@ POSSIBILITY OF SUCH DAMAGE. draggable: true }); } else { - // request service status after successful save and update status box (wait a few seconds before update) - setTimeout(function(){ - ajaxCall(url="/api/haproxy/service/status", sendData={}, callback=function(data,status) { - updateServiceStatusUI(data['status']); - }); - },3000); + ajaxCall(url="/api/haproxy/service/status", sendData={}, callback=function(data,status) { + updateServiceStatusUI(data['status']); + }); } }); }); diff --git a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/ServiceController.php b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/ServiceController.php index 419d5d9eb..f064d0445 100644 --- a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/ServiceController.php +++ b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/ServiceController.php @@ -48,8 +48,10 @@ class ServiceController extends ApiControllerBase public function startAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); - $response = $backend->configdRun("acmeclient http-start", true); + $response = $backend->configdRun("acmeclient http-start"); return array("response" => $response); } else { return array("response" => array()); @@ -63,6 +65,8 @@ class ServiceController extends ApiControllerBase public function stopAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun("acmeclient http-stop"); return array("response" => $response); @@ -78,6 +82,8 @@ class ServiceController extends ApiControllerBase public function restartAction() { if ($this->request->isPost()) { + // close session for long running action + $this->sessionClose(); $backend = new Backend(); $response = $backend->configdRun("acmeclient http-restart"); return array("response" => $response);