diff options
-rw-r--r-- | config/zabbix-agent/zabbix-agent.xml | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/config/zabbix-agent/zabbix-agent.xml b/config/zabbix-agent/zabbix-agent.xml index 24f014d2..9714e6ea 100644 --- a/config/zabbix-agent/zabbix-agent.xml +++ b/config/zabbix-agent/zabbix-agent.xml @@ -14,9 +14,10 @@ <url>/pkg_edit.php?xml=zabbix-agent.xml&id=0</url> </menu> <service> - <name>zabbix-agent</name> - <rcfile>zabbix-agentd.sh</rcfile> + <name>zabbix_agentd</name> + <rcfile>zabbix_agentd.sh</rcfile> <executable>zabbix_agentd</executable> + <description>Zabbix Agent runs on a host being monitored. The agent provides host's performance and availability information for Zabbix Server.</description> </service> <tabs> <tab> @@ -47,20 +48,29 @@ <field> <fielddescr>Hostname</fielddescr> <fieldname>hostname</fieldname> - <description>Unique hostname. Required for active checks.</description> + <description>Unique hostname. Required for active checks and must match hostname as configured on the Zabbix server (case sensitive).</description> <value>localhost</value> <type>input</type> <size>60</size> <required>true</required> </field> <field> + <fielddescr>Listen IP</fielddescr> + <fieldname>listenip</fieldname> + <value>0.0.0.0</value> + <type>input</type> + <size>60</size> + <required>true</required> + <description>Listen IP for connections from the server (generally 0.0.0.0 for all interfaces)</description> + </field> + <field> <fielddescr>Listen Port</fielddescr> <fieldname>listenport</fieldname> <value>10050</value> <type>input</type> <size>60</size> <required>true</required> - <description>Listen port for sending active check (generally 10050)</description> + <description>Listen port for connections from the server (generally 10050)</description> </field> <field> <fielddescr>Refresh Active Checks</fielddescr> @@ -81,6 +91,18 @@ <description>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!</description> </field> <field> + <fielddescr>Disable active checks</fielddescr> + <fieldname>disableactive</fieldname> + <type>checkbox</type> + <description>The agent will work only in passive mode listening for server. (generally net set)</description> + </field> + <field> + <fielddescr>Disable passive checks</fielddescr> + <fieldname>disablepassive</fieldname> + <type>checkbox</type> + <description>The agent will not listen on any TCP port. Only active checks will be processed. (generally not set)</description> + </field> + <field> <fielddescr>User Parameters</fielddescr> <fieldname>userparams</fieldname> <encoding>base64</encoding> @@ -140,6 +162,11 @@ <![CDATA[ global $_POST; + $ListenIP=$_POST['listenip']; + if (!preg_match("/^(?:\d{1,3}\.){3}\d{1,3}$/", $ListenIP)) { + $input_errors[]='Listen IP is not ip-adress.'; + } + $ListenPort=$_POST['listenport']; if (!preg_match("/^\d+$/", $ListenPort)) { $input_errors[]='Listen Port is not numeric.'; @@ -171,15 +198,18 @@ $Server=$config['installedpackages']['zabbixagent']['config'][0]['server']; $ServerPort=$config['installedpackages']['zabbixagent']['config'][0]['serverport']; $Hostname=$config['installedpackages']['zabbixagent']['config'][0]['hostname']; + $ListenIP=$config['installedpackages']['zabbixagent']['config'][0]['listenip']; $ListenPort=$config['installedpackages']['zabbixagent']['config'][0]['listenport']; $RefreshActChecks=$config['installedpackages']['zabbixagent']['config'][0]['refreshactchecks']; $Timeout=$config['installedpackages']['zabbixagent']['config'][0]['timeout']; + $DisableActive=$config['installedpackages']['zabbixagent']['config'][0]['disableactive']; + $DisablePassive=$config['installedpackages']['zabbixagent']['config'][0]['disablepassive']; $UserParams=base64_decode($config['installedpackages']['zabbixagent']['config'][0]['userparams']); $conf = "Server=$Server\n"; $conf .= "ServerPort=$ServerPort\n"; $conf .= "Hostname=$Hostname\n"; - $conf .= "ListenIP=0.0.0.0\n"; + $conf .= "ListenIP=$ListenIP\n"; $conf .= "ListenPort=$ListenPort\n"; $conf .= "StartAgents=5\n"; $conf .= "RefreshActiveChecks=$RefreshActChecks\n"; @@ -188,6 +218,12 @@ $conf .= "LogFile=/var/log/zabbix/zabbix_agentd.log\n"; $conf .= "LogFileSize=1\n"; $conf .= "Timeout=$Timeout\n"; + if (isset($DisableActive) && ($DisableActive == "on")) { + $conf .= "DisableActive=1\n"; + } + if (isset($DisablePassive) && ($DisablePassive == "on")) { + $conf .= "DisablePassive=1\n"; + } $conf .= "$UserParams\n"; file_put_contents("/usr/local/etc/zabbix/zabbix_agentd.conf", $conf); |