mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
*/*: tweaks for service start and other stuff
PR: https://github.com/opnsense/core/issues/1954
This commit is contained in:
+7
-2
@@ -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("collectd start", true);
|
||||
$response = $backend->configdRun("collectd 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("collectd 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("collectd restart");
|
||||
return array("response" => $response);
|
||||
@@ -111,7 +117,6 @@ class ServiceController extends ApiControllerBase
|
||||
$status = "unkown";
|
||||
}
|
||||
|
||||
|
||||
return array("status" => $status);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -32,7 +32,6 @@ class GeneralController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = gettext("Collectd Settings");
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
$this->view->pick('OPNsense/Collectd/general');
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#}
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
|
||||
<hr />
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_progress" class=""></i></button>
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+7
-2
@@ -49,8 +49,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("telegraf start", true);
|
||||
$response = $backend->configdRun("telegraf start");
|
||||
return array("response" => $response);
|
||||
} else {
|
||||
return array("response" => array());
|
||||
@@ -64,6 +66,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("telegraf stop");
|
||||
return array("response" => $response);
|
||||
@@ -79,6 +83,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("telegraf restart");
|
||||
return array("response" => $response);
|
||||
@@ -112,7 +118,6 @@ class ServiceController extends ApiControllerBase
|
||||
$status = "unkown";
|
||||
}
|
||||
|
||||
|
||||
return array("status" => $status);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -32,7 +32,6 @@ class GeneralController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = gettext("Telegraf Settings");
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
$this->view->pick('OPNsense/Telegraf/general');
|
||||
}
|
||||
|
||||
-1
@@ -32,7 +32,6 @@ class InputController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = gettext("Telegraf Inputs");
|
||||
$this->view->inputForm = $this->getForm("input");
|
||||
$this->view->pick('OPNsense/Telegraf/input');
|
||||
}
|
||||
|
||||
-1
@@ -32,7 +32,6 @@ class OutputController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = gettext("Telegraf Outputs");
|
||||
$this->view->outputForm = $this->getForm("output");
|
||||
$this->view->pick('OPNsense/Telegraf/output');
|
||||
}
|
||||
|
||||
@@ -34,9 +34,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<div id="general" class="tab-pane fade in active">
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
|
||||
<hr />
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_progress" class=""></i></button>
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -34,9 +34,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<div id="input" class="tab-pane fade in active">
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':inputForm,'id':'frm_input_settings'])}}
|
||||
<hr />
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_progress" class=""></i></button>
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -34,9 +34,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<div id="output" class="tab-pane fade in active">
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':outputForm,'id':'frm_output_settings'])}}
|
||||
<hr />
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_progress" class=""></i></button>
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
PLUGIN_NAME= zabbix-proxy
|
||||
PLUGIN_VERSION= 1.0
|
||||
PLUGIN_COMMENT= Zabbix-Proxy enables decentralized monitoring
|
||||
PLUGIN_COMMENT= Zabbix Proxy enables decentralized monitoring
|
||||
PLUGIN_DEPENDS= zabbix3-proxy
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
PLUGIN_DEVEL= yes
|
||||
|
||||
.include "../../Mk/plugins.mk"
|
||||
|
||||
@@ -34,7 +34,7 @@ function zabbixproxy_services()
|
||||
|
||||
if (isset($config['OPNsense']['zabbixproxy']['general']['enabled']) && $config['OPNsense']['zabbixproxy']['general']['enabled'] == 1) {
|
||||
$services[] = array(
|
||||
'description' => gettext('Zabbix-Proxy Daemon'),
|
||||
'description' => gettext('Zabbix Proxy'),
|
||||
'configd' => array(
|
||||
'restart' => array('zabbixproxy restart'),
|
||||
'start' => array('zabbixproxy start'),
|
||||
|
||||
+7
-2
@@ -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("zabbixproxy start", true);
|
||||
$response = $backend->configdRun("zabbixproxy 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("zabbixproxy 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("zabbixproxy restart");
|
||||
return array("response" => $response);
|
||||
@@ -111,7 +117,6 @@ class ServiceController extends ApiControllerBase
|
||||
$status = "unkown";
|
||||
}
|
||||
|
||||
|
||||
return array("status" => $status);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -32,7 +32,6 @@ class GeneralController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = gettext("Zabbix-Proxy Settings");
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
$this->view->pick('OPNsense/Zabbixproxy/general');
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<id>general.enabled</id>
|
||||
<label>Enable</label>
|
||||
<type>checkbox</type>
|
||||
<help>This will activate the Zabbix-Proxy service.</help>
|
||||
<help>This will activate the Zabbix Proxy service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.proxymode</id>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<acl>
|
||||
<page-services-zabbixproxy>
|
||||
<name>Services: Zabbix-Proxy</name>
|
||||
<name>Services: Zabbix Proxy</name>
|
||||
<patterns>
|
||||
<pattern>ui/zabbixproxy/*</pattern>
|
||||
<pattern>api/zabbixproxy/*</pattern>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<model>
|
||||
<mount>//OPNsense/zabbixproxy/general</mount>
|
||||
<description>Zabbix-Proxy configuration</description>
|
||||
<description>Zabbix Proxy configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<menu>
|
||||
<Services>
|
||||
<Zabbixproxy VisibleName="Zabbix-Proxy" cssClass="fa fa-eye" url="/ui/zabbixproxy/general/index" />
|
||||
<Zabbixproxy VisibleName="Zabbix Proxy" cssClass="fa fa-eye" url="/ui/zabbixproxy/general/index" />
|
||||
</Services>
|
||||
</menu>
|
||||
|
||||
@@ -28,9 +28,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#}
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
|
||||
<hr />
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_progress" class=""></i></button>
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
command:/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh;/usr/local/etc/rc.d/zabbix_proxy start
|
||||
parameters:
|
||||
type:script
|
||||
message:starting Zabbix-Proxy
|
||||
message:starting Zabbix Proxy
|
||||
|
||||
[stop]
|
||||
command:/usr/local/etc/rc.d/zabbix_proxy stop; exit 0
|
||||
parameters:
|
||||
type:script
|
||||
message:stopping Zabbix-Proxy
|
||||
message:stopping Zabbix Proxy
|
||||
|
||||
[restart]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh;/usr/local/etc/rc.d/zabbix_proxy restart
|
||||
parameters:
|
||||
type:script
|
||||
message:restarting Zabbix-Proxy
|
||||
message:restarting Zabbix Proxy
|
||||
|
||||
[reconfigure]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh;/usr/local/etc/rc.d/zabbix_proxy restart
|
||||
parameters:
|
||||
type:script
|
||||
message:reconfigure Zabbix-Proxy
|
||||
message:reconfigure Zabbix Proxy
|
||||
|
||||
[status]
|
||||
command:/usr/local/etc/rc.d/zabbix_proxy status;exit 0
|
||||
parameters:
|
||||
type:script_output
|
||||
message:request Zabbix-Proxy status
|
||||
message:request Zabbix Proxy status
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user