aboutsummaryrefslogtreecommitdiffstats
path: root/config/zabbix2/zabbix2-agent.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-12-17 08:10:06 -0500
committerjim-p <jimp@pfsense.org>2015-12-17 08:10:06 -0500
commit304481cff9e80b09cec93f72b3b6c322925d37a3 (patch)
treec90e0d0b3c80253cb5e55c7897cfcb33db10e2ae /config/zabbix2/zabbix2-agent.inc
parente4ddd3cbcafc391661c7b694ff058747eddbb8ef (diff)
parentc88682e2fef673f8e1c3956ea59537e7bc7a5106 (diff)
downloadpfsense-packages-304481cff9e80b09cec93f72b3b6c322925d37a3.tar.gz
pfsense-packages-304481cff9e80b09cec93f72b3b6c322925d37a3.tar.bz2
pfsense-packages-304481cff9e80b09cec93f72b3b6c322925d37a3.zip
Merge pull request #1218 from doktornotor/patch-4
Diffstat (limited to 'config/zabbix2/zabbix2-agent.inc')
-rw-r--r--config/zabbix2/zabbix2-agent.inc44
1 files changed, 11 insertions, 33 deletions
diff --git a/config/zabbix2/zabbix2-agent.inc b/config/zabbix2/zabbix2-agent.inc
index 4aa0d5f7..1d78a6eb 100644
--- a/config/zabbix2/zabbix2-agent.inc
+++ b/config/zabbix2/zabbix2-agent.inc
@@ -33,33 +33,19 @@ require_once("functions.inc");
require_once("pkg-utils.inc");
require_once("globals.inc");
-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;
+global $zabbix2_pkg_base;
+$pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3);
+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";
}
+define('ZABBIX_AGENT_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-agent-' . php_uname("m"));
function php_deinstall_zabbix2_agent() {
- global $config, $g;
-
- $pfs_version = php_zabbix2_pfs_version();
- $zabbix2_pkg_base = php_zabbix2_pkg_base($pfs_version);
-
- if ($pfs_version == "2.1" || $pfs_version == "2.2") {
- define('ZABBIX_AGENT_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-agent-' . php_uname("m"));
- } else {
- define('ZABBIX_AGENT_BASE', '/usr/local');
- }
+ global $config, $g, $zabbix2_pkg_base;
mwexec("/usr/bin/killall zabbix_agentd");
@@ -144,17 +130,9 @@ function validate_input_zabbix2_agent($post, &$input_errors) {
}
function sync_package_zabbix2_agent() {
- global $config, $g;
+ global $config, $g, $zabbix2_pkg_base;
conf_mount_rw();
- $pfs_version = php_zabbix2_pfs_version();
- $zabbix2_pkg_base = php_zabbix2_pkg_base($pfs_version);
-
- if ($pfs_version == "2.1" || $pfs_version == "2.2") {
- define('ZABBIX_AGENT_BASE', '/usr/pbi/' . $zabbix2_pkg_base . '-agent-' . php_uname("m"));
- } else {
- define('ZABBIX_AGENT_BASE', '/usr/local');
- }
// Check zabbix agent settings
if (is_array($config['installedpackages']['zabbixagent'])) {