aboutsummaryrefslogtreecommitdiffstats
path: root/config/zabbix-agent/zabbix-agent.xml
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-07-05 13:31:28 -0400
committerjim-p <jimp@pfsense.org>2012-07-05 13:31:28 -0400
commitdf3bd743e2cfa5026da65fe5b2ee5222f9729da4 (patch)
tree908ecf9faca028467774b0d8ff1224c53eaa822d /config/zabbix-agent/zabbix-agent.xml
parentae155534d68a41b9409efade90834a78dd3f085b (diff)
downloadpfsense-packages-df3bd743e2cfa5026da65fe5b2ee5222f9729da4.tar.gz
pfsense-packages-df3bd743e2cfa5026da65fe5b2ee5222f9729da4.tar.bz2
pfsense-packages-df3bd743e2cfa5026da65fe5b2ee5222f9729da4.zip
Zabbix agent fixes for 2.1 & cleanup.
Diffstat (limited to 'config/zabbix-agent/zabbix-agent.xml')
-rw-r--r--config/zabbix-agent/zabbix-agent.xml448
1 files changed, 233 insertions, 215 deletions
diff --git a/config/zabbix-agent/zabbix-agent.xml b/config/zabbix-agent/zabbix-agent.xml
index 9714e6ea..ce0e2339 100644
--- a/config/zabbix-agent/zabbix-agent.xml
+++ b/config/zabbix-agent/zabbix-agent.xml
@@ -1,158 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<packagegui>
- <name>zabbixagent</name>
- <title>Services: Zabbix Agent</title>
- <category>Monitoring</category>
- <version>1.0</version>
- <addedit_string>Zabbix Agent has been created/modified.</addedit_string>
- <delete_string>Zabbix Agent has been deleted.</delete_string>
- <restart_command>/usr/local/etc/rc.d/zabbix_agentd.sh restart</restart_command>
- <menu>
- <name>Zabbix Agent</name>
- <tooltiptext>Setup Zabbix Agent specific settings</tooltiptext>
- <section>Services</section>
- <url>/pkg_edit.php?xml=zabbix-agent.xml&amp;id=0</url>
- </menu>
- <service>
- <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>
- <text>Settings</text>
- <url>/pkg_edit.php?xml=zabbix-agent.xml&amp;id=0</url>
- <active />
- </tab>
- </tabs>
- <fields>
- <field>
- <fielddescr>Server</fielddescr>
- <fieldname>server</fieldname>
- <description>List of comma delimited IP addresses (or hostnames) of ZABBIX servers</description>
- <value>127.0.0.1</value>
- <type>input</type>
- <size>60</size>
- <required>true</required>
- </field>
- <field>
- <fielddescr>Server Port</fielddescr>
- <fieldname>serverport</fieldname>
- <description>Server port for sending active check (generally 10051)</description>
- <value>10051</value>
- <type>input</type>
- <size>60</size>
- <required>true</required>
- </field>
- <field>
- <fielddescr>Hostname</fielddescr>
- <fieldname>hostname</fieldname>
- <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 connections from the server (generally 10050)</description>
- </field>
- <field>
- <fielddescr>Refresh Active Checks</fielddescr>
- <fieldname>refreshactchecks</fieldname>
- <value>120</value>
- <type>input</type>
- <size>60</size>
- <required>false</required>
- <description>The agent will refresh list of active checks once per 120 (default) seconds.</description>
- </field>
- <field>
- <fielddescr>Timeout</fielddescr>
- <fieldname>timeout</fieldname>
- <value>3</value>
- <type>input</type>
- <size>60</size>
- <required>true</required>
- <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>
- <value></value>
- <type>textarea</type>
- <rows>5</rows>
- <cols>50</cols>
- <required>false</required>
- <description>User-defined parameter to monitor. There can be several user-defined parameters. Value has form, example: UserParameter=users,who|wc -l</description>
- </field>
- </fields>
+ <name>zabbixagent</name>
+ <title>Services: Zabbix Agent</title>
+ <category>Monitoring</category>
+ <version>1.1</version>
+ <addedit_string>Zabbix Agent has been created/modified.</addedit_string>
+ <delete_string>Zabbix Agent has been deleted.</delete_string>
+ <restart_command>/usr/local/etc/rc.d/zabbix_agentd.sh restart</restart_command>
+ <menu>
+ <name>Zabbix Agent</name>
+ <tooltiptext>Setup Zabbix Agent specific settings</tooltiptext>
+ <section>Services</section>
+ <url>/pkg_edit.php?xml=zabbix-agent.xml&amp;id=0</url>
+ </menu>
+ <service>
+ <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>
+ <text>Settings</text>
+ <url>/pkg_edit.php?xml=zabbix-agent.xml&amp;id=0</url>
+ <active />
+ </tab>
+ </tabs>
+ <fields>
+ <field>
+ <fielddescr>Server</fielddescr>
+ <fieldname>server</fieldname>
+ <description>List of comma delimited IP addresses (or hostnames) of ZABBIX servers</description>
+ <value>127.0.0.1</value>
+ <type>input</type>
+ <size>60</size>
+ <required>true</required>
+ </field>
+ <field>
+ <fielddescr>Server Port</fielddescr>
+ <fieldname>serverport</fieldname>
+ <description>Server port for sending active check (generally 10051)</description>
+ <value>10051</value>
+ <type>input</type>
+ <size>60</size>
+ <required>true</required>
+ </field>
+ <field>
+ <fielddescr>Hostname</fielddescr>
+ <fieldname>hostname</fieldname>
+ <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 connections from the server (generally 10050)</description>
+ </field>
+ <field>
+ <fielddescr>Refresh Active Checks</fielddescr>
+ <fieldname>refreshactchecks</fieldname>
+ <value>120</value>
+ <type>input</type>
+ <size>60</size>
+ <required>false</required>
+ <description>The agent will refresh list of active checks once per 120 (default) seconds.</description>
+ </field>
+ <field>
+ <fielddescr>Timeout</fielddescr>
+ <fieldname>timeout</fieldname>
+ <value>3</value>
+ <type>input</type>
+ <size>60</size>
+ <required>true</required>
+ <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>
+ <value></value>
+ <type>textarea</type>
+ <rows>5</rows>
+ <cols>50</cols>
+ <required>false</required>
+ <description>User-defined parameter to monitor. There can be several user-defined parameters. Value has form, example: UserParameter=users,who|wc -l</description>
+ </field>
+ </fields>
<custom_php_install_command>
<![CDATA[
- global $config, $g;
+ global $config, $g;
- mwexec("mkdir -p /var/log/zabbix/");
- mwexec("mkdir -p /var/run/zabbix/");
+ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ switch ($pfs_version) {
+ case "1.2":
+ case "2.0":
+ define('ZABBIX_AGENT_BASE','/usr/local');
+ break;
+ default:
+ define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix-agent-' . php_uname("m"));
+ }
- conf_mount_rw();
+ mwexec("mkdir -p /var/log/zabbix/");
+ mwexec("mkdir -p /var/run/zabbix/");
- /* create a few directories and ensure the sample files are in place */
- exec("/bin/mkdir -p /usr/local/etc/zabbix");
- exec("/bin/mkdir -p /var/log/zabbix");
- exec("/bin/mkdir -p /var/run/zabbix");
+ conf_mount_rw();
- exec("/bin/rm -f /usr/local/etc/rc.d/zabbix_agentd");
+ /* create a few directories and ensure the sample files are in place */
+ exec("/bin/mkdir -p " . ZABBIX_AGENT_BASE . "/etc/zabbix");
+ exec("/bin/mkdir -p /var/log/zabbix");
+ exec("/bin/mkdir -p /var/run/zabbix");
- $start = "/bin/mkdir -p /var/log/zabbix\n";
- $start .= "/usr/sbin/chown -R zabbix:zabbix /var/log/zabbix\n";
+ exec("/bin/rm -f " . ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix_agentd");
- $start .= "/bin/mkdir -p /var/run/zabbix\n";
- $start .= "/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix\n";
+ $start = "/bin/mkdir -p /var/log/zabbix\n";
+ $start .= "/usr/sbin/chown -R zabbix:zabbix /var/log/zabbix\n";
- $start .= "echo \"Starting Zabbix Agent\"...\n";
+ $start .= "/bin/mkdir -p /var/run/zabbix\n";
+ $start .= "/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix\n";
- /* start zabbix agent */
- $start .= "/usr/local/sbin/zabbix_agentd\n";
+ $start .= "echo \"Starting Zabbix Agent\"...\n";
- $stop = "echo \"Stopping Zabbix Agent\"\n";
- $stop .= "/usr/bin/killall zabbix_agentd\n";
- /* write out rc.d start/stop file */
- write_rcfile(array(
- "file" => "zabbix_agentd.sh",
- "start" => "{$start}",
- "restart" => "$stop\n" . "sleep 5\n" . "{$start}",
- "stop" => "$stop"
- )
- );
+ /* start zabbix agent */
+ $start .= ZABBIX_AGENT_BASE . "/sbin/zabbix_agentd\n";
- conf_mount_ro();
+ $stop = "echo \"Stopping Zabbix Agent\"\n";
+ $stop .= "/usr/bin/killall zabbix_agentd\n";
+ /* write out rc.d start/stop file */
+ write_rcfile(array(
+ "file" => "zabbix_agentd.sh",
+ "start" => "{$start}",
+ "restart" => "$stop\n" . "sleep 5\n" . "{$start}",
+ "stop" => "$stop"
+ )
+ );
+
+ conf_mount_ro();
]]>
</custom_php_install_command>
<custom_php_command_before_form></custom_php_command_before_form>
@@ -160,86 +170,94 @@
<custom_php_after_form_command></custom_php_after_form_command>
<custom_php_validation_command>
<![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.';
- }
-
- $ServerPort=$_POST['serverport'];
- if (!preg_match("/^\d+$/", $ServerPort)) {
- $input_errors[]='Server Port is not numeric.';
- }
-
- $RefreshActiveChecks=$_POST['refreshactchecks'];
- if (!preg_match("/^\d+$/", $RefreshActiveChecks)) {
- $input_errors[]='Refresh Active Checks is not numeric.';
- }
-
- $Timeout=$_POST['timeout'];
- if (!preg_match("/^\d+$/", $Timeout)) {
- $input_errors[]='Timeout is not numeric.';
- }
- ]]>
+ global $_POST;
+ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ switch ($pfs_version) {
+ case "1.2":
+ case "2.0":
+ define('ZABBIX_AGENT_BASE','/usr/local');
+ break;
+ default:
+ define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix-agent-' . php_uname("m"));
+ }
+
+ $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.';
+ }
+
+ $ServerPort=$_POST['serverport'];
+ if (!preg_match("/^\d+$/", $ServerPort)) {
+ $input_errors[]='Server Port is not numeric.';
+ }
+
+ $RefreshActiveChecks=$_POST['refreshactchecks'];
+ if (!preg_match("/^\d+$/", $RefreshActiveChecks)) {
+ $input_errors[]='Refresh Active Checks is not numeric.';
+ }
+
+ $Timeout=$_POST['timeout'];
+ if (!preg_match("/^\d+$/", $Timeout)) {
+ $input_errors[]='Timeout is not numeric.';
+ }
+ ]]>
</custom_php_validation_command>
<custom_add_php_command></custom_add_php_command>
<custom_php_resync_config_command>
- <![CDATA[
- conf_mount_rw();
- global $config;
- global $g;
-
- $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=$ListenIP\n";
- $conf .= "ListenPort=$ListenPort\n";
- $conf .= "StartAgents=5\n";
- $conf .= "RefreshActiveChecks=$RefreshActChecks\n";
- $conf .= "DebugLevel=3\n";
- $conf .= "PidFile=/var/run/zabbix/zabbix_agentd.pid\n";
- $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);
- conf_mount_ro();
-
- ]]>
+ <![CDATA[
+ conf_mount_rw();
+ global $config;
+ global $g;
+
+ $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=$ListenIP\n";
+ $conf .= "ListenPort=$ListenPort\n";
+ $conf .= "StartAgents=5\n";
+ $conf .= "RefreshActiveChecks=$RefreshActChecks\n";
+ $conf .= "DebugLevel=3\n";
+ $conf .= "PidFile=/var/run/zabbix/zabbix_agentd.pid\n";
+ $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(ZABBIX_AGENT_BASE . "/etc/zabbix/zabbix_agentd.conf", $conf);
+ conf_mount_ro();
+
+ ]]>
</custom_php_resync_config_command>
<custom_php_deinstall_command>
- <![CDATA[
- exec("/usr/bin/killall zabbix_agentd");
+ <![CDATA[
+ exec("/usr/bin/killall zabbix_agentd");
- exec("/bin/rm /usr/local/etc/rc.d/zabbix_agentd.sh");
+ exec("/bin/rm " . ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix_agentd.sh");
- exec("/bin/rm -r /var/log/zabbix/");
- exec("/bin/rm -r /var/run/zabbix/");
+ exec("/bin/rm -r /var/log/zabbix/");
+ exec("/bin/rm -r /var/run/zabbix/");
]]>
</custom_php_deinstall_command>
-</packagegui>
-
+</packagegui> \ No newline at end of file