aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/zabbix2/zabbix2.inc54
-rw-r--r--pkg_config.10.xml8
2 files changed, 42 insertions, 20 deletions
diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc
index 13713988..77f1d6e1 100644
--- a/config/zabbix2/zabbix2.inc
+++ b/config/zabbix2/zabbix2.inc
@@ -2,10 +2,10 @@
/* $Id$ */
/* ========================================================================== */
/*
- zabbix2-proxy.inc
+ zabbix2.inc
part of the Zabbix package for pfSense
Copyright (C) 2013 Danilo G. Baio
- Copyright (C) 2013 Marcello Coutinho
+ Copyright (C) 2013 Marcello Coutinho
All rights reserved.
*/
@@ -46,16 +46,18 @@ function php_deinstall_zabbix2_agent(){
global $config, $g;
conf_mount_rw();
- $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ $pfs_version = php_zabbix2_pfs_version();
+ $zabbix2_pkg_base = php_zabbix2_pkg_base($pfs_version);
+
if ($pfs_version > 2.0){
- define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix22-agent-' . php_uname("m"));
+ define('ZABBIX_AGENT_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-agent-' . php_uname("m"));
} else {
define('ZABBIX_AGENT_BASE', '/usr/local');
}
exec("/usr/bin/killall zabbix_agentd");
unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix2_agentd.sh");
- unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/zabbix22/zabbix_agentd.conf");
+ unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/" . $zabbix2_pkg_base . "/zabbix_agentd.conf");
unlink_if_exists("/var/log/zabbix2/zabbix2_agentd.log");
unlink_if_exists("/var/run/zabbix2/zabbix2_agentd.pid");
@@ -73,16 +75,18 @@ function php_deinstall_zabbix2_proxy(){
global $config, $g;
conf_mount_rw();
- $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ $pfs_version = php_zabbix2_pfs_version();
+ $zabbix2_pkg_base = php_zabbix2_pkg_base($pfs_version);
+
if ($pfs_version > 2.0){
- define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix22-proxy-' . php_uname("m"));
+ define('ZABBIX_PROXY_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-proxy-' . php_uname("m"));
} else {
define('ZABBIX_PROXY_BASE', '/usr/local');
}
exec("/usr/bin/killall zabbix_proxy");
unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/rc.d/zabbix2_proxy.sh");
- unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy.conf");
+ unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/" . $zabbix2_pkg_base . "/zabbix_proxy.conf");
unlink_if_exists("/var/log/zabbix2/zabbix_proxy.log");
unlink_if_exists("/var/run/zabbix2/zabbix2_proxy.pid");
@@ -177,11 +181,12 @@ function sync_package_zabbix2(){
global $config, $g;
conf_mount_rw();
- #check pfsense version
- $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ $pfs_version = php_zabbix2_pfs_version();
+ $zabbix2_pkg_base = php_zabbix2_pkg_base($pfs_version);
+
if ($pfs_version > 2.0){
- define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix22-agent-' . php_uname("m"));
- define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix22-proxy-' . php_uname("m"));
+ define('ZABBIX_AGENT_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-agent-' . php_uname("m"));
+ define('ZABBIX_PROXY_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-proxy-' . php_uname("m"));
}
else {
define('ZABBIX_AGENT_BASE', '/usr/local');
@@ -210,7 +215,7 @@ ProxyMode={$Mode}
{$AdvancedParams}
EOF;
- file_put_contents(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => "")));
+ file_put_contents(ZABBIX_PROXY_BASE . "/etc/" . $zabbix2_pkg_base . "/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => "")));
}
}
/* check zabbix agent settings*/
@@ -244,7 +249,7 @@ StartAgents={$StartAgents}
{$UserParams}
EOF;
- file_put_contents(ZABBIX_AGENT_BASE . "/etc/zabbix22/zabbix_agentd.conf", strtr($zbagent_conf_file, array("\r" => "")));
+ file_put_contents(ZABBIX_AGENT_BASE . "/etc/" . $zabbix2_pkg_base . "/zabbix_agentd.conf", strtr($zbagent_conf_file, array("\r" => "")));
}
}
$want_sysctls = array(
@@ -293,8 +298,8 @@ EOF;
/*check startup script files*/
/* create a few directories and ensure the sample files are in place */
- if (!is_dir(ZABBIX_PROXY_BASE . "/etc/zabbix22"))
- exec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/zabbix22");
+ if (!is_dir(ZABBIX_PROXY_BASE . "/etc/" . $zabbix2_pkg_base))
+ exec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/" . $zabbix2_pkg_base);
$dir_checks = <<< EOF
if [ ! -d /var/log/zabbix2 ]
@@ -371,4 +376,21 @@ EOF;
conf_mount_ro();
}
+
+function php_zabbix2_pfs_version(){
+ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ return $pfs_version;
+}
+
+function php_zabbix2_pkg_base($pfs_version){
+ if ($pfs_version >= 2.2){
+ // pfSense 2.2 with zabbix 2.4
+ $zabbix2_pkg_base = "zabbix24";
+ }else{
+ // pfSense 2.1 with zabbix 2.2
+ $zabbix2_pkg_base = "zabbix22";
+ }
+ return $zabbix2_pkg_base;
+}
+
?>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index 7717b6dd..48b2adc5 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -1326,7 +1326,7 @@
<descr>Monitoring agent.</descr>
<category>Services</category>
<config_file>https://packages.pfsense.org/packages/config/zabbix2/zabbix2-agent.xml</config_file>
- <version>zabbix2-agent-2.2.7 pkg v0.8.3</version>
+ <version>zabbix2-agent-2.4.3 pkg v0.8.3</version>
<status>BETA</status>
<required_version>2.2</required_version>
<configurationfile>zabbix2-agent.xml</configurationfile>
@@ -1335,14 +1335,14 @@
<custom_name>zabbix24-agent</custom_name>
<port>net-mgmt/zabbix24-agent</port>
</build_pbi>
- <depends_on_package_pbi>zabbix22-agent-2.2.7-##ARCH##.pbi</depends_on_package_pbi>
+ <depends_on_package_pbi>zabbix24-agent-2.4.3-##ARCH##.pbi</depends_on_package_pbi>
</package>
<package>
<name>Zabbix-2 Proxy</name>
<descr>Monitoring agent proxy.</descr>
<category>Services</category>
<config_file>https://packages.pfsense.org/packages/config/zabbix2/zabbix2-proxy.xml</config_file>
- <version>zabbix2-proxy-2.2.7 pkg v0.8.3</version>
+ <version>zabbix2-proxy-2.4.3 pkg v0.8.3</version>
<status>BETA</status>
<required_version>2.2</required_version>
<configurationfile>zabbix2-proxy.xml</configurationfile>
@@ -1352,7 +1352,7 @@
<port>net-mgmt/zabbix24-proxy</port>
</build_pbi>
<build_options>OPTIONS_SET+= SQLITE IPV6;OPTIONS_UNSET+= MYSQL JABBER GSSAPI</build_options>
- <depends_on_package_pbi>zabbix22-proxy-2.2.7-##ARCH##.pbi</depends_on_package_pbi>
+ <depends_on_package_pbi>zabbix24-proxy-2.4.3-##ARCH##.pbi</depends_on_package_pbi>
</package>
<package>
<name>sudo</name>