Framework: switch to 20.1 development track
This commit is contained in:
parent
c4923b3a18
commit
93c4acce98
2
Makefile
2
Makefile
|
@ -25,7 +25,7 @@
|
|||
|
||||
PAGER?= less
|
||||
|
||||
PLUGIN_ABI= 19.1
|
||||
PLUGIN_ABI= 19.7
|
||||
|
||||
all:
|
||||
@cat ${.CURDIR}/README.md | ${PAGER}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
PLUGIN_NAME= zabbix-proxy
|
||||
PLUGIN_VERSION= 1.1
|
||||
PLUGIN_COMMENT= Zabbix Proxy enables decentralized monitoring
|
||||
PLUGIN_DEPENDS= zabbix3-proxy
|
||||
PLUGIN_CONFLICTS= zabbix4-proxy
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
|
||||
.include "../../Mk/plugins.mk"
|
|
@ -1,10 +0,0 @@
|
|||
Zabbix is an enterprise-class open source distributed monitoring solution.
|
||||
|
||||
Zabbix is software that monitors numerous parameters of a network and the
|
||||
health and integrity of servers. Zabbix uses a flexible notification
|
||||
mechanism that allows users to configure e-mail based alerts for virtually
|
||||
any event. This allows a fast reaction to server problems. Zabbix offers
|
||||
excellent reporting and data visualisation features based on the stored
|
||||
data. This makes Zabbix ideal for capacity planning.
|
||||
|
||||
WWW: http://www.zabbix.com/
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function zabbixproxy_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = array();
|
||||
|
||||
if (isset($config['OPNsense']['zabbixproxy']['general']['enabled']) && $config['OPNsense']['zabbixproxy']['general']['enabled'] == 1) {
|
||||
$services[] = array(
|
||||
'description' => gettext('Zabbix Proxy'),
|
||||
'configd' => array(
|
||||
'restart' => array('zabbixproxy restart'),
|
||||
'start' => array('zabbixproxy start'),
|
||||
'stop' => array('zabbixproxy stop'),
|
||||
),
|
||||
'name' => 'zabbixproxy',
|
||||
'pidfile' => '/var/run/zabbix/zabbix_proxy.pid'
|
||||
);
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2015 - 2017 Deciso B.V.
|
||||
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OPNsense\Zabbixproxy\Api;
|
||||
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Zabbixproxy\General;
|
||||
use \OPNsense\Core\Config;
|
||||
|
||||
class GeneralController extends ApiControllerBase
|
||||
{
|
||||
public function getAction()
|
||||
{
|
||||
// define list of configurable settings
|
||||
$result = array();
|
||||
if ($this->request->isGet()) {
|
||||
$mdlGeneral = new General();
|
||||
$result['general'] = $mdlGeneral->getNodes();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function setAction()
|
||||
{
|
||||
$result = array("result"=>"failed");
|
||||
if ($this->request->isPost()) {
|
||||
// load model and update with provided data
|
||||
$mdlGeneral = new General();
|
||||
$mdlGeneral->setNodes($this->request->getPost("general"));
|
||||
|
||||
// perform validation
|
||||
$valMsgs = $mdlGeneral->performValidation();
|
||||
foreach ($valMsgs as $field => $msg) {
|
||||
if (!array_key_exists("validations", $result)) {
|
||||
$result["validations"] = array();
|
||||
}
|
||||
$result["validations"]["general.".$msg->getField()] = $msg->getMessage();
|
||||
}
|
||||
|
||||
// serialize model to config and save
|
||||
if ($valMsgs->count() == 0) {
|
||||
$mdlGeneral->serializeToConfig();
|
||||
Config::getInstance()->save();
|
||||
$result["result"] = "saved";
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2015 - 2017 Deciso B.V.
|
||||
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OPNsense\Zabbixproxy\Api;
|
||||
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Core\Backend;
|
||||
use \OPNsense\Zabbixproxy\General;
|
||||
|
||||
/**
|
||||
* Class ServiceController
|
||||
* @package OPNsense\Zabbixproxy
|
||||
*/
|
||||
class ServiceController extends ApiControllerBase
|
||||
{
|
||||
/**
|
||||
* start zabbixproxy service (in background)
|
||||
* @return array
|
||||
*/
|
||||
public function startAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
// close session for long running action
|
||||
$this->sessionClose();
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdRun("zabbixproxy start");
|
||||
return array("response" => $response);
|
||||
} else {
|
||||
return array("response" => array());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* stop zabbixproxy service
|
||||
* @return array
|
||||
*/
|
||||
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);
|
||||
} else {
|
||||
return array("response" => array());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* restart zabbixproxy service
|
||||
* @return array
|
||||
*/
|
||||
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);
|
||||
} else {
|
||||
return array("response" => array());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* retrieve status of zabbixproxy
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function statusAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$mdlGeneral = new General();
|
||||
$response = $backend->configdRun("zabbixproxy status");
|
||||
|
||||
if (strpos($response, "not running") > 0) {
|
||||
if ($mdlGeneral->enabled->__toString() == 1) {
|
||||
$status = "stopped";
|
||||
} else {
|
||||
$status = "disabled";
|
||||
}
|
||||
} elseif (strpos($response, "is running") > 0) {
|
||||
$status = "running";
|
||||
} elseif ($mdlGeneral->enabled->__toString() == 0) {
|
||||
$status = "disabled";
|
||||
} else {
|
||||
$status = "unkown";
|
||||
}
|
||||
|
||||
return array("status" => $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* reconfigure zabbixproxy, generate config and reload
|
||||
*/
|
||||
public function reconfigureAction()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
// close session for long running action
|
||||
$this->sessionClose();
|
||||
|
||||
$mdlGeneral = new General();
|
||||
$backend = new Backend();
|
||||
|
||||
$runStatus = $this->statusAction();
|
||||
|
||||
// stop zabbixproxy if it is running or not
|
||||
$this->stopAction();
|
||||
|
||||
// generate template
|
||||
$backend->configdRun('template reload OPNsense/Zabbixproxy');
|
||||
|
||||
// (res)start daemon
|
||||
if ($mdlGeneral->enabled->__toString() == 1) {
|
||||
$this->startAction();
|
||||
}
|
||||
|
||||
return array("status" => "ok");
|
||||
} else {
|
||||
return array("status" => "failed");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Zabbixproxy;
|
||||
|
||||
class GeneralController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->generalForm = $this->getForm("general");
|
||||
$this->view->pick('OPNsense/Zabbixproxy/general');
|
||||
}
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
<form>
|
||||
<field>
|
||||
<id>general.enabled</id>
|
||||
<label>Enable</label>
|
||||
<type>checkbox</type>
|
||||
<help>This will activate the Zabbix Proxy service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.proxymode</id>
|
||||
<label>Proxy Mode</label>
|
||||
<type>checkbox</type>
|
||||
<help>Active (default) or passive mode, only switch to passive if you know what you are doing.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.server</id>
|
||||
<label>Server</label>
|
||||
<type>text</type>
|
||||
<help>IP address or hostname of Zabbix server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.serverport</id>
|
||||
<label>Server Port</label>
|
||||
<type>text</type>
|
||||
<help>Port of Zabbix trapper on Zabbix server. Default is fine for most scenarios.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.hostname</id>
|
||||
<label>Hostname</label>
|
||||
<type>text</type>
|
||||
<help>The name of this Zabbix instance. It has to match with the defined name in the central Zabbix server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.listenip</id>
|
||||
<label>Listen IP</label>
|
||||
<type>text</type>
|
||||
<help>List of comma delimited IP addresses that the trapper should listen on. Trapper will listen on all network interfaces if this parameter is missing.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.listenport</id>
|
||||
<label>Listen Port</label>
|
||||
<type>text</type>
|
||||
<help>Listen port for trapper. Default is just fine.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.sourceip</id>
|
||||
<label>Source IP</label>
|
||||
<type>text</type>
|
||||
<help>Source IP address for outgoing connections.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.startpollers</id>
|
||||
<label>Start Pollers</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of pollers.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.startipmipollers</id>
|
||||
<label>Start IPMI Pollers</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of IPMI pollers.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.startpollersunreachable</id>
|
||||
<label>Start Pollers Unreachable</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java).</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.starttrappers</id>
|
||||
<label>Start Trappers</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of trappers. Trappers accept incoming connections from Zabbix sender and active agents.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.startpingers</id>
|
||||
<label>Start Pingers</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of ICMP pingers.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.startdiscoverers</id>
|
||||
<label>Start Discoverers</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of discoverers.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.starthttppollers</id>
|
||||
<label>Start HTTP Pollers</label>
|
||||
<type>text</type>
|
||||
<help>Number of pre-forked instances of HTTP pollers.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.cachesize</id>
|
||||
<label>Cache Size</label>
|
||||
<type>text</type>
|
||||
<help>Size of configuration cache, in bytes. Shared memory size, for storing hosts and items data. Range: 128K-8G</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.historycachesize</id>
|
||||
<label>History Cache Size</label>
|
||||
<type>text</type>
|
||||
<help>Size of history cache in bytes. Shared memory size for storing history data. Range: 128K-2G</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.historyindexcachesize</id>
|
||||
<label>History Index Cache Size</label>
|
||||
<type>text</type>
|
||||
<help>Size of history index cache in bytes. Shared memory size for indexing history cache. Range: 128K-2G</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.timeout</id>
|
||||
<label>Timeout</label>
|
||||
<type>text</type>
|
||||
<help>Specifies how long we wait for agent, SNMP device or external check (in seconds).</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.encryption</id>
|
||||
<label>PSK based encryption</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable PSK based encryption for communicating with the Zabbix server</help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.encryptionidentity</id>
|
||||
<label>PSK Identity</label>
|
||||
<type>text</type>
|
||||
<help>The PSK identity configured on the Zabbix server</help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.encryptionpsk</id>
|
||||
<label>PSK</label>
|
||||
<type>text</type>
|
||||
<help>The PSK configured on the Zabbix server</help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
</form>
|
|
@ -1,9 +0,0 @@
|
|||
<acl>
|
||||
<page-services-zabbixproxy>
|
||||
<name>Services: Zabbix Proxy</name>
|
||||
<patterns>
|
||||
<pattern>ui/zabbixproxy/*</pattern>
|
||||
<pattern>api/zabbixproxy/*</pattern>
|
||||
</patterns>
|
||||
</page-services-zabbixproxy>
|
||||
</acl>
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Zabbixproxy;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
|
||||
class General extends BaseModel
|
||||
{
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
<model>
|
||||
<mount>//OPNsense/zabbixproxy/general</mount>
|
||||
<description>Zabbix Proxy configuration</description>
|
||||
<version>1.1.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<proxymode type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</proxymode>
|
||||
<server type="TextField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
</server>
|
||||
<serverport type="TextField">
|
||||
<default>10051</default>
|
||||
<Required>N</Required>
|
||||
</serverport>
|
||||
<hostname type="TextField">
|
||||
<default>Zabbix proxy</default>
|
||||
<Required>Y</Required>
|
||||
</hostname>
|
||||
<listenport type="TextField">
|
||||
<default>10051</default>
|
||||
<Required>N</Required>
|
||||
</listenport>
|
||||
<listenip type="NetworkField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
</listenip>
|
||||
<sourceip type="NetworkField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
</sourceip>
|
||||
<startpollers type="TextField">
|
||||
<default>5</default>
|
||||
<Required>N</Required>
|
||||
</startpollers>
|
||||
<startipmipollers type="IntegerField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</startipmipollers>
|
||||
<startpollersunreachable type="IntegerField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</startpollersunreachable>
|
||||
<starttrappers type="IntegerField">
|
||||
<default>5</default>
|
||||
<Required>N</Required>
|
||||
</starttrappers>
|
||||
<startpingers type="IntegerField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</startpingers>
|
||||
<startdiscoverers type="IntegerField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</startdiscoverers>
|
||||
<starthttppollers type="IntegerField">
|
||||
<default>1</default>
|
||||
<Required>N</Required>
|
||||
</starthttppollers>
|
||||
<cachesize type="TextField">
|
||||
<default>8M</default>
|
||||
<Required>N</Required>
|
||||
</cachesize>
|
||||
<historycachesize type="TextField">
|
||||
<default>16M</default>
|
||||
<Required>N</Required>
|
||||
</historycachesize>
|
||||
<historyindexcachesize type="TextField">
|
||||
<default>4M</default>
|
||||
<Required>N</Required>
|
||||
</historyindexcachesize>
|
||||
<timeout type="IntegerField">
|
||||
<default>4</default>
|
||||
<Required>N</Required>
|
||||
</timeout>
|
||||
<encryption type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</encryption>
|
||||
<encryptionidentity type="TextField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
<mask>/^.{1,128}$/</mask>
|
||||
<ValidationMessage>Should be a string between 1 and 128 characters.</ValidationMessage>
|
||||
</encryptionidentity>
|
||||
<encryptionpsk type="TextField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
<mask>/^[A-Fa-f0-9]{32,512}$/</mask>
|
||||
<ValidationMessage>Should be a hexadecimal string between 32 and 512 characters.</ValidationMessage>
|
||||
</encryptionpsk>
|
||||
</items>
|
||||
</model>
|
|
@ -1,5 +0,0 @@
|
|||
<menu>
|
||||
<Services>
|
||||
<Zabbixproxy VisibleName="Zabbix Proxy" cssClass="fa fa-eye" url="/ui/zabbixproxy/general/index" />
|
||||
</Services>
|
||||
</menu>
|
|
@ -1,61 +0,0 @@
|
|||
{#
|
||||
|
||||
OPNsense® is Copyright © 2014 – 2017 by Deciso B.V.
|
||||
This file is Copyright © 2017 by Michael Muenz <m.muenz@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#}
|
||||
<div class="content-box" style="padding-bottom: 1.5em;">
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
|
||||
<div class="col-md-12">
|
||||
<hr />
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
var data_get_map = {'frm_general_settings':"/api/zabbixproxy/general/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data){
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
ajaxCall(url="/api/zabbixproxy/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
|
||||
// link save button to API set action
|
||||
$("#saveAct").click(function(){
|
||||
saveFormToEndpoint(url="/api/zabbixproxy/general/set", formid='frm_general_settings',callback_ok=function(){
|
||||
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
|
||||
ajaxCall(url="/api/zabbixproxy/service/reconfigure", sendData={}, callback=function(data,status) {
|
||||
ajaxCall(url="/api/zabbixproxy/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Setup database directory
|
||||
mkdir -p /var/db/zabbix
|
||||
chown -R zabbix:zabbix /var/db/zabbix
|
||||
chmod 755 /var/db/zabbix
|
||||
|
||||
# Setup logging
|
||||
touch /var/log/zabbix_proxy.log
|
||||
chown -R zabbix:zabbix /var/log/zabbix_proxy.log
|
||||
|
||||
# Setup PID directory
|
||||
mkdir -p /var/run/zabbix
|
||||
chown -R zabbix:zabbix /var/run/zabbix
|
||||
chmod 755 /var/run/zabbix
|
|
@ -1,23 +0,0 @@
|
|||
[start]
|
||||
command:/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh;/usr/local/etc/rc.d/zabbix_proxy start
|
||||
parameters:
|
||||
type:script
|
||||
message:starting Zabbix Proxy
|
||||
|
||||
[stop]
|
||||
command:/usr/local/etc/rc.d/zabbix_proxy stop; exit 0
|
||||
parameters:
|
||||
type:script
|
||||
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
|
||||
|
||||
[status]
|
||||
command:/usr/local/etc/rc.d/zabbix_proxy status;exit 0
|
||||
parameters:
|
||||
type:script_output
|
||||
message:request Zabbix Proxy status
|
|
@ -1,3 +0,0 @@
|
|||
zabbix_proxy:/etc/rc.conf.d/zabbix_proxy
|
||||
zabbix_proxy.conf:/usr/local/etc/zabbix3/zabbix_proxy.conf
|
||||
zabbix_proxy.psk:/usr/local/etc/zabbix3/zabbix_proxy.psk
|
|
@ -1,6 +0,0 @@
|
|||
{% if helpers.exists('OPNsense.zabbixproxy.general.enabled') and OPNsense.zabbixproxy.general.enabled == '1' %}
|
||||
zabbix_proxy_var_script="/usr/local/opnsense/scripts/OPNsense/Zabbixproxy/setup.sh"
|
||||
zabbix_proxy_enable="YES"
|
||||
{% else %}
|
||||
zabbix_proxy_enable="NO"
|
||||
{% endif %}
|
|
@ -1,73 +0,0 @@
|
|||
{% if helpers.exists('OPNsense.zabbixproxy.general.enabled') and OPNsense.zabbixproxy.general.enabled == '1' %}
|
||||
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.proxymode') and OPNsense.zabbixproxy.general.proxymode == '1' %}
|
||||
ProxyMode=1
|
||||
{% else %}
|
||||
ProxyMode=0
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.server') and OPNsense.zabbixproxy.general.server != '' %}
|
||||
Server={{ OPNsense.zabbixproxy.general.server }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.serverport') and OPNsense.zabbixproxy.general.serverport != '' %}
|
||||
ServerPort={{ OPNsense.zabbixproxy.general.serverport }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.hostname') and OPNsense.zabbixproxy.general.hostname != '' %}
|
||||
Hostname={{ OPNsense.zabbixproxy.general.hostname }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.listenport') and OPNsense.zabbixproxy.general.listenport != '' %}
|
||||
ListenPort={{ OPNsense.zabbixproxy.general.listenport }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.sourceip') and OPNsense.zabbixproxy.general.sourceip != '' %}
|
||||
SourceIP={{ OPNsense.zabbixproxy.general.sourceip }}
|
||||
{% endif %}
|
||||
LogFile=/var/log/zabbix_proxy.log
|
||||
PidFile=/var/run/zabbix/zabbix_proxy.pid
|
||||
DBName=/var/db/zabbix/zabbix_proxy.db
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.startpollers') and OPNsense.zabbixproxy.general.startpollers != '' %}
|
||||
StartPollers={{ OPNsense.zabbixproxy.general.startpollers }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.startipmipollers') and OPNsense.zabbixproxy.general.startipmipollers != '' %}
|
||||
StartIPMIPollers={{ OPNsense.zabbixproxy.general.startipmipollers }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.startpollersunreachable') and OPNsense.zabbixproxy.general.startpollersunreachable != '' %}
|
||||
StartPollersUnreachable={{ OPNsense.zabbixproxy.general.startpollersunreachable }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.starttrappers') and OPNsense.zabbixproxy.general.starttrappers != '' %}
|
||||
StartTrappers={{ OPNsense.zabbixproxy.general.starttrappers }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.startpingers') and OPNsense.zabbixproxy.general.startpingers != '' %}
|
||||
StartPingers={{ OPNsense.zabbixproxy.general.startpingers }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.startdiscoverers') and OPNsense.zabbixproxy.general.startdiscoverers != '' %}
|
||||
StartDiscoverers={{ OPNsense.zabbixproxy.general.startdiscoverers }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.starthttppollers') and OPNsense.zabbixproxy.general.starthttppollers != '' %}
|
||||
StartHTTPPollers={{ OPNsense.zabbixproxy.general.starthttppollers }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.listenip') and OPNsense.zabbixproxy.general.listenip != '' %}
|
||||
ListenIP={{ OPNsense.zabbixproxy.general.listenip }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.cachesize') and OPNsense.zabbixproxy.general.cachesize != '' %}
|
||||
CacheSize={{ OPNsense.zabbixproxy.general.cachesize }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.historycachesize') and OPNsense.zabbixproxy.general.historycachesize != '' %}
|
||||
HistoryCacheSize={{ OPNsense.zabbixproxy.general.historycachesize }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.historyindexcachesize') and OPNsense.zabbixproxy.general.historyindexcachesize != '' %}
|
||||
HistoryIndexCacheSize={{ OPNsense.zabbixproxy.general.historyindexcachesize }}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.timeout') and OPNsense.zabbixproxy.general.timeout != '' %}
|
||||
Timeout={{ OPNsense.zabbixproxy.general.timeout }}
|
||||
{% endif %}
|
||||
FpingLocation=/usr/local/sbin/fping
|
||||
Fping6Location=/usr/local/sbin/fping6
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.encryption') and OPNsense.zabbixproxy.general.encryption == '1' %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.proxymode') and OPNsense.zabbixproxy.general.proxymode == '1' %}
|
||||
TLSAccept=psk
|
||||
{% else %}
|
||||
TLSConnect=psk
|
||||
{% endif %}
|
||||
TLSPSKFile=/usr/local/etc/zabbix3/zabbix_proxy.psk
|
||||
TLSPSKIdentity={{ OPNsense.zabbixproxy.general.encryptionidentity }}
|
||||
{% endif %}
|
||||
{% endif %}
|
|
@ -1,5 +0,0 @@
|
|||
{% if helpers.exists('OPNsense.zabbixproxy.general.enabled') and OPNsense.zabbixproxy.general.enabled == '1' %}
|
||||
{% if helpers.exists('OPNsense.zabbixproxy.general.encryption') and OPNsense.zabbixproxy.general.encryption == '1' %}
|
||||
{{ OPNsense.zabbixproxy.general.encryptionpsk }}
|
||||
{% endif %}
|
||||
{% endif %}
|
|
@ -3,7 +3,6 @@ PLUGIN_VERSION= 1.0
|
|||
PLUGIN_REVISION= 1
|
||||
PLUGIN_COMMENT= Zabbix Proxy enables decentralized monitoring
|
||||
PLUGIN_DEPENDS= zabbix4-proxy
|
||||
PLUGIN_CONFLICTS= zabbix-proxy
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
|
||||
.include "../../Mk/plugins.mk"
|
||||
|
|
Loading…
Reference in New Issue