aboutsummaryrefslogtreecommitdiffstats
path: root/config/zabbix2-agent
diff options
context:
space:
mode:
authormarcelloc <marcellocoutinho@gmail.com>2013-02-11 01:36:16 -0200
committermarcelloc <marcellocoutinho@gmail.com>2013-02-11 01:36:16 -0200
commita67b748e2428950343488085c4a60021d83a43d5 (patch)
tree8ec178797593db154f133f818b52ee89be9cf713 /config/zabbix2-agent
parentdd5d6380fecbd2e502d1378348b735adb678cbea (diff)
downloadpfsense-packages-a67b748e2428950343488085c4a60021d83a43d5.tar.gz
pfsense-packages-a67b748e2428950343488085c4a60021d83a43d5.tar.bz2
pfsense-packages-a67b748e2428950343488085c4a60021d83a43d5.zip
zabbix2 - split xml into xml and inc file.
Use same inc dir and file for zabbix agent and client as both scripts are very similar
Diffstat (limited to 'config/zabbix2-agent')
-rw-r--r--config/zabbix2-agent/zabbix2-agent.xml336
1 files changed, 0 insertions, 336 deletions
diff --git a/config/zabbix2-agent/zabbix2-agent.xml b/config/zabbix2-agent/zabbix2-agent.xml
deleted file mode 100644
index cadc9ed8..00000000
--- a/config/zabbix2-agent/zabbix2-agent.xml
+++ /dev/null
@@ -1,336 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packagegui>
- <name>zabbixagent</name>
- <title>Services: Zabbix-2 Agent</title>
- <category>Monitoring</category>
- <version>0.6</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/zabbix2_agentd.sh restart</restart_command>
- <menu>
- <name>Zabbix-2 Agent</name>
- <tooltiptext>Setup Zabbix Agent specific settings</tooltiptext>
- <section>Services</section>
- <url>/pkg_edit.php?xml=zabbix2-agent.xml&amp;id=0</url>
- </menu>
- <service>
- <name>zabbix_agentd</name>
- <rcfile>zabbix2_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=zabbix2-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 Active</fielddescr>
- <fieldname>serveractive</fieldname>
- <description>List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks</description>
- <value></value>
- <type>input</type>
- <size>60</size>
- </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>
- <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>Buffer Send</fielddescr>
- <fieldname>buffersend</fieldname>
- <value>5</value>
- <type>input</type>
- <size>60</size>
- <description>Buffer Send (default 5). Do not keep data longer than N seconds in buffer (1-3600).</description>
- </field>
- <field>
- <fielddescr>Buffer Size</fielddescr>
- <fieldname>buffersize</fieldname>
- <value>100</value>
- <type>input</type>
- <size>60</size>
- <description>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.</description>
- </field>
- <field>
- <fielddescr>Start Agents</fielddescr>
- <fieldname>startagents</fieldname>
- <value>3</value>
- <type>input</type>
- <size>60</size>
- <description>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.</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;
-
- $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/zabbix2-agent-' . php_uname("m"));
- }
-
- mwexec("mkdir -p /var/log/zabbix2/");
- mwexec("mkdir -p /var/run/zabbix2/");
-
- conf_mount_rw();
-
- /* create a few directories and ensure the sample files are in place */
- exec("/bin/mkdir -p " . ZABBIX_AGENT_BASE . "/etc/zabbix2");
- exec("/bin/mkdir -p /var/log/zabbix2");
- exec("/bin/mkdir -p /var/run/zabbix2");
-
- exec("/bin/rm -f " . ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix2_agentd");
-
- /* rc_file options */
- $start = "/bin/mkdir -p /var/log/zabbix2\n";
- $start .= "/usr/sbin/chown -R zabbix:zabbix /var/log/zabbix2\n";
- $start .= "/bin/mkdir -p /var/run/zabbix2\n";
- $start .= "/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix2\n";
- $start .= "echo \"Starting Zabbix Agent...\"\n";
- $start .= ZABBIX_AGENT_BASE . "/sbin/zabbix_agentd\n";
-
- $stop = "echo \"Stopping Zabbix Agent...\"\n";
- $stop .= "/usr/bin/killall zabbix_agentd\n";
- $stop .= "/bin/sleep 5\n";
-
- /* write out rc.d start/stop file */
- write_rcfile(array(
- "file" => "zabbix2_agentd.sh",
- "start" => "$start",
- "stop" => "$stop"
- )
- );
-
- conf_mount_ro();
- ]]>
- </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;
- $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/zabbix2-agent-' . php_uname("m"));
- }
-
- $ListenIP=$_POST['listenip'];
- if (!preg_match("/^(?:\d{1,3}\.){3}\d{1,3}$/", $ListenIP)) {
- $input_errors[]='Listen IP is not an IP address.';
- }
-
- $ListenPort=$_POST['listenport'];
- if (!preg_match("/^\d+$/", $ListenPort)) {
- $input_errors[]='Listen Port is not numeric.';
- }
-
- $RefreshActiveChecks=$_POST['refreshactchecks'];
- if ($RefreshActiveChecks != '') {
- if (!preg_match("/^\d+$/", $RefreshActiveChecks)) {
- $input_errors[]='Refresh Active Checks is not numeric.';
- } elseif ( $RefreshActiveChecks < 60 || $RefreshActiveChecks > 3600 ) {
- $input_errors[]='You must enter a valid value for \'Refresh Active Checks\'';
- }
- }
-
- $Timeout=$_POST['timeout'];
- if (!preg_match("/^\d+$/", $Timeout)) {
- $input_errors[]='Timeout is not numeric.';
- } elseif ( $Timeout < 1 || $Timeout > 255 ) {
- $input_errors[]='You must enter a valid value for \'Timeout\'';
- }
-
- $BufferSend=$_POST['buffersend'];
- if ($BufferSend != '') {
- if (!preg_match("/^\d+$/", $BufferSend)) {
- $input_errors[]='Buffer Send is not numeric.';
- } elseif ( $BufferSend < 1 || $BufferSend > 3600 ) {
- $input_errors[]='You must enter a valid value for \'Buffer Send\'';
- }
- }
-
- $BufferSize=$_POST['buffersize'];
- if ($BufferSize != '') {
- if (!preg_match("/^\d+$/", $BufferSize)) {
- $input_errors[]='Bufer Size is not numeric.';
- } elseif ( $BufferSize < 2 || $BufferSize > 65535 ) {
- $input_errors[]='You must enter a valid value for \'Buffer Size\'';
- }
- }
-
- $StartAgents=$_POST['startagents'];
- if ($StartAgents != '') {
- if (!preg_match("/^\d+$/", $StartAgents)) {
- $input_errors[]='Start Agents is not numeric.';
- } elseif ( $StartAgents < 0 || $StartAgents > 100 ) {
- $input_errors[]='You must enter a valid value for \'Start Agents\'';
- }
- }
-
- ]]>
- </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'];
- $ServerActive=$config['installedpackages']['zabbixagent']['config'][0]['serveractive'];
- $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'] ? $config['installedpackages']['zabbixagent']['config'][0]['refreshactchecks'] : 120);
- $Timeout=$config['installedpackages']['zabbixagent']['config'][0]['timeout'];
- $BufferSend=($config['installedpackages']['zabbixagent']['config'][0]['buffersend'] ? $config['installedpackages']['zabbixagent']['config'][0]['buffersend'] : 5);
- $BufferSize=($config['installedpackages']['zabbixagent']['config'][0]['buffersize'] ? $config['installedpackages']['zabbixagent']['config'][0]['buffersize'] : 100);
- $StartAgents=($config['installedpackages']['zabbixagent']['config'][0]['startagents'] != '' ? $config['installedpackages']['zabbixagent']['config'][0]['startagents'] : 3);
- $UserParams=base64_decode($config['installedpackages']['zabbixagent']['config'][0]['userparams']);
-
- $conf = "Server=$Server\n";
- $conf .= "ServerActive=$ServerActive\n";
- $conf .= "Hostname=$Hostname\n";
- $conf .= "ListenIP=$ListenIP\n";
- $conf .= "ListenPort=$ListenPort\n";
- $conf .= "RefreshActiveChecks=$RefreshActChecks\n";
- $conf .= "DebugLevel=3\n";
- $conf .= "PidFile=/var/run/zabbix2/zabbix2_agentd.pid\n";
- $conf .= "LogFile=/var/log/zabbix2/zabbix2_agentd.log\n";
- $conf .= "LogFileSize=1\n";
- $conf .= "Timeout=$Timeout\n";
- $conf .= "BufferSend=$BufferSend\n";
- $conf .= "BufferSize=$BufferSize\n";
- $conf .= "StartAgents=$StartAgents\n";
- $conf .= "$UserParams\n";
-
- file_put_contents(ZABBIX_AGENT_BASE . "/etc/zabbix2/zabbix_agentd.conf", $conf);
-
- /* rc_file options */
- $start = "/bin/mkdir -p /var/log/zabbix2\n";
- $start .= "/usr/sbin/chown -R zabbix:zabbix /var/log/zabbix2\n";
- $start .= "/bin/mkdir -p /var/run/zabbix2\n";
- $start .= "/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix2\n";
- $start .= "echo \"Starting Zabbix Agent...\"\n";
- $start .= ZABBIX_AGENT_BASE . "/sbin/zabbix_agentd\n";
-
- $stop = "echo \"Stopping Zabbix Agent...\"\n";
- $stop .= "/usr/bin/killall zabbix_agentd\n";
- $stop .= "/bin/sleep 5\n";
-
- /* write out rc.d start/stop file */
- write_rcfile(array(
- "file" => "zabbix2_agentd.sh",
- "start" => "$start",
- "stop" => "$stop"
- )
- );
-
- conf_mount_ro();
-
- ]]>
- </custom_php_resync_config_command>
- <custom_php_deinstall_command>
- <![CDATA[
- $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
- switch ($pfs_version) {
- case "1.2":
- case "2.0":
- define('ZABBIX_PROXY_BASE','/usr/local');
- define('ZABBIX_AGENT_BASE','/usr/local');
- break;
- default:
- define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix2-proxy-' . php_uname("m"));
- define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix2-agent-' . php_uname("m"));
- }
-
- exec("/usr/bin/killall zabbix_agentd");
-
- exec("/bin/rm " . ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix2_agentd.sh");
-
- // Check if Zabbix-2 Proxy exists
- if(file_exists(ZABBIX_PROXY_BASE . "/etc/zabbix2/zabbix_proxy.conf")) {
- exec("/bin/rm /var/log/zabbix2/zabbix2_agentd.log");
- exec("/bin/rm /var/run/zabbix2/zabbix2_agentd.pid");
- } else {
- exec("/bin/rm -r /var/log/zabbix2/");
- exec("/bin/rm -r /var/run/zabbix2/");
- }
- ]]>
- </custom_php_deinstall_command>
-</packagegui>