net-mgmt/zabbix-agent: sync service start and small fixes

PR: https://github.com/opnsense/core/issues/1954
This commit is contained in:
Franco Fichtner
2017-11-28 20:31:56 +00:00
parent 75ca6c01f8
commit 35a5083f9e
6 changed files with 13 additions and 13 deletions
+1 -2
View File
@@ -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
@@ -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'),
@@ -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);
@@ -41,8 +41,6 @@ class IndexController extends \OPNsense\Base\IndexController
*/
public function indexAction()
{
// set page title
$this->view->title = gettext('Zabbix Agent Settings');
// include form definitions
$this->view->settingsForm = $this->getForm("settings");
// pick the template to serve
@@ -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']);
});
}
});
});
@@ -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