From dfff4b70d87adc49264925db06f47423bff0adc4 Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Tue, 12 Nov 2013 23:30:37 -0200 Subject: zabbix2 - fix default values --- config/zabbix2/zabbix2-agent.xml | 24 ++++++++++-------------- config/zabbix2/zabbix2-proxy.xml | 2 +- config/zabbix2/zabbix2.inc | 37 +++++++++++++++++++++++-------------- 3 files changed, 34 insertions(+), 29 deletions(-) (limited to 'config/zabbix2') diff --git a/config/zabbix2/zabbix2-agent.xml b/config/zabbix2/zabbix2-agent.xml index 61e0f52f..0169e11f 100644 --- a/config/zabbix2/zabbix2-agent.xml +++ b/config/zabbix2/zabbix2-agent.xml @@ -85,7 +85,6 @@ Server server List of comma delimited IP addresses (or hostnames) of ZABBIX servers - 127.0.0.1 input 60 @@ -93,7 +92,6 @@ Server Active serveractive List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks - input 60 @@ -101,30 +99,29 @@ Hostname hostname Unique hostname. Required for active checks and must match hostname as configured on the Zabbix server (case sensitive). - localhost input 60 Listen IP listenip - 0.0.0.0 + 0.0.0.0 input 60 - Listen IP for connections from the server (generally 0.0.0.0 for all interfaces) + Listen IP for connections from the server (default 0.0.0.0 for all interfaces) Listen Port listenport - 10050 + 10050 input 5 - Listen port for connections from the server (generally 10050) + Listen port for connections from the server (default 10050) Refresh Active Checks refreshactchecks - 120 + 120 input 5 The agent will refresh list of active checks once per 120 (default) seconds. @@ -132,15 +129,15 @@ Timeout timeout - 3 + 3 input 5 - Timeout (default 3). Do not spend more that Timeout seconds on getting requested value (1-255). The agent does not kill timeouted User Parameters processes! + Timeout (default 3). Do not spend more that Timeout seconds on getting requested value (1-30). The agent does not kill timeouted User Parameters processes! Buffer Send buffersend - 5 + 5 input 5 Buffer Send (default 5). Do not keep data longer than N seconds in buffer (1-3600). @@ -148,7 +145,7 @@ Buffer Size buffersize - 100 + 100 input 5 Buffer Size (default 100). Maximum number of values in a memory buffer (2-65535). The agent will send all collected data to Zabbix server or proxy if the buffer is full. @@ -156,7 +153,7 @@ Start Agents startagents - 3 + 3 input 5 Start Agents (default 3). Number of pre-forked instances of zabbix_agentd that process passive checks (0-100).If set to 0, disables passive checks and the agent will not listen on any TCP port. @@ -165,7 +162,6 @@ User Parameters userparams base64 - textarea 5 50 diff --git a/config/zabbix2/zabbix2-proxy.xml b/config/zabbix2/zabbix2-proxy.xml index d9402bac..c687c5ba 100644 --- a/config/zabbix2/zabbix2-proxy.xml +++ b/config/zabbix2/zabbix2-proxy.xml @@ -58,7 +58,7 @@ /pkg_edit.php?xml=zabbix2-proxy.xml&id=0 - zabbix-proxy + zabbix_proxy zabbix2_proxy.sh zabbix_proxy Zabbix proxy collection daemon diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc index 34777387..0a1c12be 100644 --- a/config/zabbix2/zabbix2.inc +++ b/config/zabbix2/zabbix2.inc @@ -118,14 +118,18 @@ function validate_input_zabbix2($post,&$input_errors){ if (!preg_match("/\w+/", $post['hostname'])) { $input_errors[]='Hostname field is required.'; } - - if (!is_ipaddr_configured($post['listenip']) && !preg_match("/(127.0.0.1|0.0.0.0)/",$post['listenip'])) { - $input_errors[]='Listen IP is not a configured IP address.'; + + if ($post['listenip'] != '') { + if (!is_ipaddr_configured($post['listenip']) && !preg_match("/(127.0.0.1|0.0.0.0)/",$post['listenip'])) { + $input_errors[]='Listen IP is not a configured IP address.'; } + } - if (!preg_match("/^\d+$/", $post['listenport'])) { - $input_errors[]='Listen Port is not numeric.'; + if ($post['listenport'] != '') { + if (!preg_match("/^\d+$/", $post['listenport'])) { + $input_errors[]='Listen Port is not numeric.'; } + } if ($post['refreshactchecks'] != '') { if (!preg_match("/^\d+$/", $post['refreshactchecks'])) { @@ -134,11 +138,13 @@ function validate_input_zabbix2($post,&$input_errors){ $input_errors[]='You must enter a valid value for \'Refresh Active Checks\''; } } - - if (!is_numericint($post['timeout'])) { - $input_errors[]='Timeout is not numeric.'; - } elseif ( $post['timeout'] < 1 || $post['timeout'] > 255 ) { - $input_errors[]='You must enter a valid value for \'Timeout\''; + + if ($post['timeout'] != '') { + if (!is_numericint($post['timeout'])) { + $input_errors[]='Timeout is not numeric.'; + } elseif ( $post['timeout'] < 1 || $post['timeout'] > 30 ) { + $input_errors[]='You must enter a valid value for \'Timeout\''; + } } if ($post['buffersend'] != '') { @@ -214,19 +220,22 @@ EOF; $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']); - + $ListenIp=($zbagent_config['listenip'] != ''? $zbagent_config['listenip'] : "0.0.0.0"); + $ListenPort=($zbagent_config['listenport'] != ''? $zbagent_config['listenport'] : "10050"); + $TimeOut=($zbagent_config['timeout'] != ''? $zbagent_config['timeout'] : "3"); + $zbagent_conf_file = <<< EOF Server={$zbagent_config['server']} ServerActive={$zbagent_config['serveractive']} Hostname={$zbagent_config['hostname']} -ListenIP={$zbagent_config['listenip']} -ListenPort={$zbagent_config['listenport']} +ListenIP={$ListenIp} +ListenPort={$ListenPort} RefreshActiveChecks={$RefreshActChecks} DebugLevel=3 PidFile=/var/run/zabbix2/zabbix2_agentd.pid LogFile=/var/log/zabbix2/zabbix2_agentd.log LogFileSize=1 -Timeout={$zbagent_config['timeout']} +Timeout={$TimeOut} BufferSend={$BufferSend} BufferSize={$BufferSize} StartAgents={$StartAgents} -- cgit v1.2.3