aboutsummaryrefslogtreecommitdiffstats
path: root/config/zabbix2
diff options
context:
space:
mode:
Diffstat (limited to 'config/zabbix2')
-rw-r--r--config/zabbix2/zabbix2-agent.xml30
-rw-r--r--config/zabbix2/zabbix2-proxy.xml8
-rw-r--r--config/zabbix2/zabbix2.inc122
3 files changed, 94 insertions, 66 deletions
diff --git a/config/zabbix2/zabbix2-agent.xml b/config/zabbix2/zabbix2-agent.xml
index 41ba26fb..0169e11f 100644
--- a/config/zabbix2/zabbix2-agent.xml
+++ b/config/zabbix2/zabbix2-agent.xml
@@ -41,7 +41,7 @@
<name>zabbixagent</name>
<title>Services: Zabbix-2 Agent</title>
<category>Monitoring</category>
- <version>0.7</version>
+ <version>0.7_1</version>
<include_file>/usr/local/pkg/zabbix2.inc</include_file>
<addedit_string>Zabbix Agent has been created/modified.</addedit_string>
<delete_string>Zabbix Agent has been deleted.</delete_string>
@@ -61,7 +61,7 @@
<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>
+ <description>Zabbix Agent host monitor daemon</description>
</service>
<tabs>
<tab>
@@ -85,7 +85,6 @@
<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>
</field>
@@ -93,7 +92,6 @@
<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>
@@ -101,30 +99,29 @@
<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>
</field>
<field>
<fielddescr>Listen IP</fielddescr>
<fieldname>listenip</fieldname>
- <value>0.0.0.0</value>
+ <default_value>0.0.0.0</default_value>
<type>input</type>
<size>60</size>
- <description>Listen IP for connections from the server (generally 0.0.0.0 for all interfaces)</description>
+ <description>Listen IP for connections from the server (default 0.0.0.0 for all interfaces)</description>
</field>
<field>
<fielddescr>Listen Port</fielddescr>
<fieldname>listenport</fieldname>
- <value>10050</value>
+ <default_value>10050</default_value>
<type>input</type>
<size>5</size>
- <description>Listen port for connections from the server (generally 10050)</description>
+ <description>Listen port for connections from the server (default 10050)</description>
</field>
<field>
<fielddescr>Refresh Active Checks</fielddescr>
<fieldname>refreshactchecks</fieldname>
- <value>120</value>
+ <default_value>120</default_value>
<type>input</type>
<size>5</size>
<description>The agent will refresh list of active checks once per 120 (default) seconds.</description>
@@ -132,15 +129,15 @@
<field>
<fielddescr>Timeout</fielddescr>
<fieldname>timeout</fieldname>
- <value>3</value>
+ <default_value>3</default_value>
<type>input</type>
<size>5</size>
- <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>
+ <description>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!</description>
</field>
<field>
<fielddescr>Buffer Send</fielddescr>
<fieldname>buffersend</fieldname>
- <value>5</value>
+ <default_value>5</default_value>
<type>input</type>
<size>5</size>
<description>Buffer Send (default 5). Do not keep data longer than N seconds in buffer (1-3600).</description>
@@ -148,7 +145,7 @@
<field>
<fielddescr>Buffer Size</fielddescr>
<fieldname>buffersize</fieldname>
- <value>100</value>
+ <default_value>100</default_value>
<type>input</type>
<size>5</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>
@@ -156,7 +153,7 @@
<field>
<fielddescr>Start Agents</fielddescr>
<fieldname>startagents</fieldname>
- <value>3</value>
+ <default_value>3</default_value>
<type>input</type>
<size>5</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>
@@ -165,7 +162,6 @@
<fielddescr>User Parameters</fielddescr>
<fieldname>userparams</fieldname>
<encoding>base64</encoding>
- <value></value>
<type>textarea</type>
<rows>5</rows>
<cols>50</cols>
@@ -179,5 +175,5 @@
<custom_php_validation_command>validate_input_zabbix2($_POST, &amp;$input_errors);</custom_php_validation_command>
<custom_add_php_command></custom_add_php_command>
<custom_php_resync_config_command>sync_package_zabbix2();</custom_php_resync_config_command>
- <custom_php_deinstall_command>php_deinstall_zabbix2();</custom_php_deinstall_command>
+ <custom_php_deinstall_command>php_deinstall_zabbix2_agent();</custom_php_deinstall_command>
</packagegui>
diff --git a/config/zabbix2/zabbix2-proxy.xml b/config/zabbix2/zabbix2-proxy.xml
index 4441df99..c687c5ba 100644
--- a/config/zabbix2/zabbix2-proxy.xml
+++ b/config/zabbix2/zabbix2-proxy.xml
@@ -41,7 +41,7 @@
<name>zabbixproxy</name>
<title>Services: Zabbix-2 Proxy</title>
<category>Monitoring</category>
- <version>0.7</version>
+ <version>0.7_1</version>
<include_file>/usr/local/pkg/zabbix2.inc</include_file>
<addedit_string>Zabbix Proxy has been created/modified.</addedit_string>
<delete_string>Zabbix Proxy has been deleted.</delete_string>
@@ -58,10 +58,10 @@
<url>/pkg_edit.php?xml=zabbix2-proxy.xml&amp;id=0</url>
</menu>
<service>
- <name>zabbix-proxy</name>
+ <name>zabbix_proxy</name>
<rcfile>zabbix2_proxy.sh</rcfile>
<executable>zabbix_proxy</executable>
- <description>Zabbix proxy is a process which collects performance and availability data from one or more monitored devices and sends the information to a Zabbix server</description>
+ <description>Zabbix proxy collection daemon</description>
</service>
<tabs>
<tab>
@@ -137,5 +137,5 @@
<custom_php_validation_command>validate_input_zabbix2($_POST, &amp;$input_errors);</custom_php_validation_command>
<custom_add_php_command></custom_add_php_command>
<custom_php_resync_config_command>sync_package_zabbix2();</custom_php_resync_config_command>
- <custom_php_deinstall_command>php_deinstall_zabbix2();</custom_php_deinstall_command>
+ <custom_php_deinstall_command>php_deinstall_zabbix2_proxy();</custom_php_deinstall_command>
</packagegui>
diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc
index 730ef873..0a1c12be 100644
--- a/config/zabbix2/zabbix2.inc
+++ b/config/zabbix2/zabbix2.inc
@@ -42,38 +42,61 @@ function php_install_zabbix2(){
sync_package_zabbix2();
}
-function php_deinstall_zabbix2(){
- global $config, $g;
+function php_deinstall_zabbix2_agent(){
+ global $config, $g;
- conf_mount_rw();
- $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
- if ($pfs_version > 2.0){
- define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix2-agent-' . php_uname("m"));
- define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix2-proxy-' . php_uname("m"));
- } else {
- define('ZABBIX_AGENT_BASE', '/usr/local');
- define('ZABBIX_PROXY_BASE', '/usr/local');
- }
-
- exec("/usr/bin/killall zabbix_proxy");
- unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/rc.d/zabbix2_proxy.sh");
- unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix2/zabbix_proxy.conf");
- unlink_if_exists("/var/log/zabbix2/zabbix_proxy.log");
- unlink_if_exists("/var/run/zabbix2/zabbix2_proxy.pid");
-
- exec("/usr/bin/killall zabbix_agentd");
- unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix2_agentd.sh");
- unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/zabbix2/zabbix_agentd.conf");
- unlink_if_exists("/var/log/zabbix2/zabbix2_agentd.log");
- unlink_if_exists("/var/run/zabbix2/zabbix2_agentd.pid");
-
- if (is_dir("/var/log/zabbix2"))
- exec("/bin/rm -r /var/log/zabbix2/");
- if (is_dir("/var/run/zabbix2"))
- exec("/bin/rm -r /var/run/zabbix2/");
- if (is_dir("/var/db/zabbix2"))
- exec("/bin/rm -r /var/db/zabbix2/");
- conf_mount_ro();
+ conf_mount_rw();
+ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ if ($pfs_version > 2.0){
+ define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix2-agent-' . php_uname("m"));
+ } else {
+ define('ZABBIX_AGENT_BASE', '/usr/local');
+ }
+
+ exec("/usr/bin/killall zabbix_agentd");
+ unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix2_agentd.sh");
+ unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/zabbix2/zabbix_agentd.conf");
+ unlink_if_exists("/var/log/zabbix2/zabbix2_agentd.log");
+ unlink_if_exists("/var/run/zabbix2/zabbix2_agentd.pid");
+
+ if (!is_array($config['installedpackages']['zabbixproxy'])){
+ if (is_dir("/var/log/zabbix2"))
+ exec("/bin/rm -r /var/log/zabbix2/");
+ if (is_dir("/var/run/zabbix2"))
+ exec("/bin/rm -r /var/run/zabbix2/");
+ }
+
+ conf_mount_ro();
+}
+
+function php_deinstall_zabbix2_proxy(){
+ global $config, $g;
+
+ conf_mount_rw();
+ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
+ if ($pfs_version > 2.0){
+ define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix2-proxy-' . php_uname("m"));
+ } else {
+ define('ZABBIX_PROXY_BASE', '/usr/local');
+ }
+
+ exec("/usr/bin/killall zabbix_proxy");
+ unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/rc.d/zabbix2_proxy.sh");
+ unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix2/zabbix_proxy.conf");
+ unlink_if_exists("/var/log/zabbix2/zabbix_proxy.log");
+ unlink_if_exists("/var/run/zabbix2/zabbix2_proxy.pid");
+
+ if (!is_array($config['installedpackages']['zabbixagent'])){
+ if (is_dir("/var/log/zabbix2"))
+ exec("/bin/rm -r /var/log/zabbix2/");
+ if (is_dir("/var/run/zabbix2"))
+ exec("/bin/rm -r /var/run/zabbix2/");
+ }
+
+ if (is_dir("/var/db/zabbix2"))
+ exec("/bin/rm -r /var/db/zabbix2/");
+
+ conf_mount_ro();
}
function validate_input_zabbix2($post,&$input_errors){
@@ -95,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'])) {
@@ -111,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'] != '') {
@@ -191,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}