diff options
author | Remco Verhoef <remcoverhoef@pfsense.org> | 2007-11-04 00:22:14 +0000 |
---|---|---|
committer | Remco Verhoef <remcoverhoef@pfsense.org> | 2007-11-04 00:22:14 +0000 |
commit | 08a8cecf94aad13f8e37c6140dc78bc1932dfd1a (patch) | |
tree | d3d21049c94fca81591e0def7582528933d9ebd4 /packages | |
parent | 677631b45506bd75e1ccad12942fc80a2dc8b35c (diff) | |
download | pfsense-packages-08a8cecf94aad13f8e37c6140dc78bc1932dfd1a.tar.gz pfsense-packages-08a8cecf94aad13f8e37c6140dc78bc1932dfd1a.tar.bz2 pfsense-packages-08a8cecf94aad13f8e37c6140dc78bc1932dfd1a.zip |
Added Zabbix Agent Package.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/zabbix-agent.xml | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/packages/zabbix-agent.xml b/packages/zabbix-agent.xml new file mode 100644 index 00000000..6585314f --- /dev/null +++ b/packages/zabbix-agent.xml @@ -0,0 +1,170 @@ +<?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&id=0</url> + </menu> + <service> + <name>zabbix-agent</name> + <rcfile>zabbix-agentd.sh</rcfile> + <executable>zabbix-agentd</executable> + </service> + <tabs> + <tab> + <text>Settings</text> + <url>/pkg_edit.php?xml=zabbix-agent.xml&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</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.</description> + <value>localhost</value> + <type>input</type> + <size>60</size> + <required>true</required> + </field> + <field> + <fielddescr>Listen Port</fielddescr> + <fieldname>listenport</fieldname> + <value>10050</value> + <type>input</type> + <size>60</size> + <required>true</required> + </field> + </fields> + <custom_php_install_command> + <![CDATA[ + global $config, $g; + + mwexec("mkdir -p /var/log/zabbix/"); + mwexec("mkdir -p /var/run/zabbix/"); + + conf_mount_rw(); + + /* 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"); + + exec("/bin/rm -f /usr/local/etc/rc.d/zabbix_agentd"); + + $start = "/bin/mkdir -p /var/log/zabbix;"; + $start .= "/usr/sbin/chown -R zabbix:zabbix /var/log/zabbix;"; + + $start .= "/bin/mkdir -p /var/run/zabbix;"; + $start .= "/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix;"; + + /* start snort */ + $start .= "/usr/local/bin/zabbix_agentd;"; + + /* write out rc.d start/stop file */ + write_rcfile(array( + "file" => "zabbix_agentd.sh", + "start" => "{$start}", + "restart" => "/usr/bin/killall zabbix_agentd; {$start};", + "stop" => "/usr/bin/killall zabbix_agentd;" + ) + ); + + $conf = "Server=127.0.0.1\n"; + $conf .= "StartAgents=5\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=3\n"; + + file_put_contents("/usr/local/etc/zabbix/zabbix_agentd.conf", $conf); + + conf_mount_ro(); + + start_service("zabbix_agentd"); + ]]> + </custom_php_install_command> + <custom_php_command_before_form></custom_php_command_before_form> + <custom_php_after_head_command></custom_php_after_head_command> + <custom_php_after_form_command></custom_php_after_form_command> + <custom_php_validation_command> + <![CDATA[ + global $_POST; + + $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.'; + } + ]]> + </custom_php_validation_command> + <custom_add_php_command></custom_add_php_command> + <custom_php_resync_config_command> + <![CDATA[ + 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']; + $ListenPort=$config['installedpackages']['zabbixagent']['config'][0]['listenport']; + + $conf = "Server=$Server\n"; + $conf .= "ServerPort=$ServerPort\n"; + $conf .= "Hostname=$Hostname\n"; + $conf .= "ListenPort=$ListenPort\n"; + $conf .= "Hostname=$Hostname\n"; + $conf .= "StartAgents=5\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=3\n"; + + file_put_contents("/usr/local/etc/zabbix/zabbix_agentd.conf", $conf); + + ]]> + </custom_php_resync_config_command> + <custom_php_resync_command></custom_php_resync_command> + <custom_php_deinstall_command> + <![CDATA[ + exec("/usr/bin/killall zabbix_agentd"); + + exec("/bin/rm /usr/local/etc/rc.d/zabbix_agentd.sh"); + + exec("/bin/rm -r /var/log/zabbix/"); + exec("/bin/rm -r /var/run/zabbix/"); + ]]> + </custom_php_deinstall_command> +</packagegui> |