aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authormarcelloc <marcellocoutinho@gmail.com>2013-02-12 01:15:19 -0200
committermarcelloc <marcellocoutinho@gmail.com>2013-02-12 01:15:19 -0200
commit8c6e405c7432044a4d0788c8c38baccb76b34bf7 (patch)
tree7fb33619a22d2b888b66d123d03aed2a21853927 /config
parent330cb18c98016369e3c215b65bb475c90c8730dc (diff)
downloadpfsense-packages-8c6e405c7432044a4d0788c8c38baccb76b34bf7.tar.gz
pfsense-packages-8c6e405c7432044a4d0788c8c38baccb76b34bf7.tar.bz2
pfsense-packages-8c6e405c7432044a4d0788c8c38baccb76b34bf7.zip
zabbix2 - fix agent config generation
Diffstat (limited to 'config')
-rw-r--r--config/zabbix2/zabbix2.inc25
1 files changed, 12 insertions, 13 deletions
diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc
index 1de2a34b..af5b3545 100644
--- a/config/zabbix2/zabbix2.inc
+++ b/config/zabbix2/zabbix2.inc
@@ -185,31 +185,30 @@ EOF;
if (is_array($config['installedpackages']['zabbixagent'])){
$zbagent_config = $config['installedpackages']['zabbixagent']['config'][0];
if ($zbagent_config['agentenabled']=="on"){
- $RefreshActChecks=($zbagent_config['refreshactchecks'] ? $zbagent_config['refreshactchecks'] : 120);
- $BufferSend=($zbagent_config['buffersend'] ? $zbagent_config['buffersend'] : 5);
- $BufferSize=($zbagent_config['buffersize'] ? $zbagent_config['buffersize'] : 100);
- $StartAgents=($zbagent_config['startagents'] != '' ? $zbagent_config['startagents'] : 3);
+ $RefreshActChecks=(preg_match("/(\d+)/",$zbagent_config['refreshactchecks'],$matches)? $matches[1] : "120");
+ $BufferSend=(preg_match("/(\d+)/",$zbagent_config['buffersend'],$matches)? $matches[1] : "5" );
+ $BufferSize=(preg_match("/(\d+)/",$zbagent_config['buffersize'],$matches)? $matches[1] : "100");
+ $StartAgents=(preg_match("/(\d+)/",$zbagent_config['startagents'],$matches)? $matches[1] :"3" );
$UserParams=base64_decode($zbagent_config['userparams']);
$zbagent_conf_file = <<< EOF
Server={$zbagent_config['server']}
-ServerActive={$zbagent_config['serveractive']}]
+ServerActive={$zbagent_config['serveractive']}
Hostname={$zbagent_config['hostname']}
ListenIP={$zbagent_config['listenip']}
ListenPort={$zbagent_config['listenport']}
-RefreshActiveChecks={$StartAgents};
-DebugLevel=3\n";
-PidFile=/var/run/zabbix2/zabbix2_agentd.pid\n";
-LogFile=/var/log/zabbix2/zabbix2_agentd.log\n";
-LogFileSize=1\n";
+RefreshActiveChecks={$RefreshActChecks}
+DebugLevel=3
+PidFile=/var/run/zabbix2/zabbix2_agentd.pid
+LogFile=/var/log/zabbix2/zabbix2_agentd.log
+LogFileSize=1
Timeout={$zbagent_config['timeout']}
BufferSend={$BufferSend}
BufferSize={$BufferSize}
-StartAgents={$zbagent_config['server']}
-$UserParams\n";
+StartAgents={$StartAgents}
+{$UserParams}
EOF;
-
file_put_contents(ZABBIX_AGENT_BASE . "/etc/zabbix2/zabbix_agentd.conf", strtr($zbagent_conf_file, array("\r" => "")));
}
}