aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-09-17 12:39:46 -0400
committerjim-p <jimp@pfsense.org>2010-09-17 12:39:46 -0400
commit80f3745d5f5aab9b66bc645577c2c23b13c0f088 (patch)
treec4495fe0248192961dabc801242973414fa142c2 /config
parentfc799f930d94a1a4409f4cb3a4d61f2063c9ee40 (diff)
downloadpfsense-packages-80f3745d5f5aab9b66bc645577c2c23b13c0f088.tar.gz
pfsense-packages-80f3745d5f5aab9b66bc645577c2c23b13c0f088.tar.bz2
pfsense-packages-80f3745d5f5aab9b66bc645577c2c23b13c0f088.zip
Add some Zabbix Proxy enhancements from IngmarHupp on the forum.
Ref: http://forum.pfsense.org/index.php/topic,28174.msg147817.html#msg147817
Diffstat (limited to 'config')
-rw-r--r--config/zabbix-proxy/zabbix-proxy.xml93
1 files changed, 65 insertions, 28 deletions
diff --git a/config/zabbix-proxy/zabbix-proxy.xml b/config/zabbix-proxy/zabbix-proxy.xml
index b5a6a818..fce266c6 100644
--- a/config/zabbix-proxy/zabbix-proxy.xml
+++ b/config/zabbix-proxy/zabbix-proxy.xml
@@ -3,7 +3,7 @@
<name>zabbixproxy</name>
<title>Services: Zabbix Proxy</title>
<category>Monitoring</category>
- <version>1.0</version>
+ <version>1.01</version>
<addedit_string>Zabbix Proxy has been created/modified.</addedit_string>
<delete_string>Zabbix Proxy has been deleted.</delete_string>
<restart_command>/usr/local/etc/rc.d/zabbix_proxy.sh restart</restart_command>
@@ -30,27 +30,44 @@
<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>
+ <default_value>127.0.0.1</default_value>
<type>input</type>
- <size>60</size>
+ <size>100</size>
<required>true</required>
</field>
<field>
<fielddescr>Server Port</fielddescr>
<fieldname>serverport</fieldname>
<description>Server port (generally 10051)</description>
- <value>10051</value>
+ <default_value>10051</default_value>
<type>input</type>
- <size>60</size>
+ <size>6</size>
<required>true</required>
</field>
<field>
<fielddescr>Hostname</fielddescr>
<fieldname>hostname</fieldname>
<description>Unique, case-sensitive proxy name. Make sure the proxy name is known to the server</description>
- <value>localhost</value>
+ <default_value>localhost</default_value>
<type>input</type>
- <size>60</size>
+ <size>100</size>
+ <required>true</required>
+ </field>
+ <field>
+ <fielddescr>Active Mode</fielddescr>
+ <fieldname>activemode</fieldname>
+ <description>Check to run Zabbix proxy in active mode (default)</description>
+ <default_value>on</default_value>
+ <type>checkbox</type>
+ <required>true</required>
+ </field>
+ <field>
+ <fielddescr>Config Frequency</fielddescr>
+ <fieldname>configfrequency</fieldname>
+ <description>How often the proxy retrieves configuration data from the Zabbix server in seconds. Ignored if the proxy runs in passive mode.</description>
+ <default_value>3600</default_value>
+ <type>input</type>
+ <size>10</size>
<required>true</required>
</field>
</fields>
@@ -60,6 +77,7 @@
mwexec("mkdir -p /var/log/zabbix/");
mwexec("mkdir -p /var/run/zabbix/");
+ mwexec("mkdir -p /var/db/zabbix/");
conf_mount_rw();
@@ -67,6 +85,7 @@
exec("/bin/mkdir -p /usr/local/etc/zabbix");
exec("/bin/mkdir -p /var/log/zabbix");
exec("/bin/mkdir -p /var/run/zabbix");
+ exec("/bin/mkdir -p /var/db/zabbix");
exec("/bin/rm -f /usr/local/etc/rc.d/zabbix_proxy");
@@ -76,13 +95,16 @@
$start .= "/bin/mkdir -p /var/run/zabbix\n";
$start .= "/usr/sbin/chown -R zabbix:zabbix /var/run/zabbix\n";
- $start .= "echo \"Starting Zabbix Proxy\"...\n";
+ $start .= "/bin/mkdir -p /var/db/zabbix\n";
+ $start .= "/usr/sbin/chown -R zabbix:zabbix /var/db/zabbix\n";
+
+ $start .= "echo \"Starting Zabbix Proxy\"...\n";
/* start zabbix proxy */
$start .= "/usr/local/sbin/zabbix_proxy\n";
- $stop = "echo \"Stopping Zabbix Proxy\"\n";
- $stop .= "/usr/bin/killall zabbix_proxy\n";
+ $stop = "echo \"Stopping Zabbix Proxy\"\n";
+ $stop .= "kill `cat /var/run/zabbix/zabbix_proxy.pid`\n";
/* write out rc.d start/stop file */
write_rcfile(array(
"file" => "zabbix_proxy.sh",
@@ -100,12 +122,17 @@
<custom_php_after_form_command></custom_php_after_form_command>
<custom_php_validation_command>
<![CDATA[
- global $_POST;
-
- $ServerPort=$_POST['serverport'];
- if (!preg_match("/^\d+$/", $ServerPort)) {
- $input_errors[]='Server Port is not numeric.';
- }
+ global $_POST;
+
+ $ServerPort=$_POST['serverport'];
+ if (!preg_match("/^\d+$/", $ServerPort)) {
+ $input_errors[]='Server Port is not numeric.';
+ }
+
+ $ConfigFrequency=$_POST['configfrequency'];
+ if (!preg_match("/^\d+$/", $ConfigFrequency)) {
+ $input_errors[]='Config Frequency is not numeric.';
+ }
]]>
</custom_php_validation_command>
<custom_add_php_command></custom_add_php_command>
@@ -114,22 +141,31 @@
conf_mount_rw();
global $config;
global $g;
+ $zabbixproxy_config = $config['installedpackages']['zabbixproxy']['config'][0];
+
+ $Server=$zabbixproxy_config['server'];
+ $ServerPort=$zabbixproxy_config['serverport'];
+ $Hostname=$zabbixproxy_config['hostname'];
+ $ListenPort=$zabbixproxy_config['listenport'];
+ $ConfigFrequency=$zabbixproxy_config['configfrequency'];
+ if(isset($zabbixproxy_config['activemode'])) {
+ $Mode="0"; /* active */
+ } else {
+ $Mode="1"; /* passive */
+ }
- $Server=$config['installedpackages']['zabbixproxy']['config'][0]['server'];
- $ServerPort=$config['installedpackages']['zabbixproxy']['config'][0]['serverport'];
- $Hostname=$config['installedpackages']['zabbixproxy']['config'][0]['hostname'];
- $ListenPort=$config['installedpackages']['zabbixproxy']['config'][0]['listenport'];
- $RefreshActChecks=$config['installedpackages']['zabbixproxy']['config'][0]['refreshactchecks'];
- $Timeout=$config['installedpackages']['zabbixproxy']['config'][0]['timeout'];
- $UserParams=$config['installedpackages']['zabbixproxy']['config'][0]['userparams'];
$conf = "Server=$Server\n";
$conf .= "ServerPort=$ServerPort\n";
$conf .= "Hostname=$Hostname\n";
$conf .= "PidFile=/var/run/zabbix/zabbix_proxy.pid\n";
- $conf .= "DBName=/var/run/zabbix/proxy.db\n";
+ $conf .= "DBName=/var/db/zabbix/proxy.db\n";
$conf .= "LogFile=/var/log/zabbix/zabbix_proxy.log\n";
- $conf .= "ConfigFrequency=60\n";
+ $conf .= "ConfigFrequency=$ConfigFrequency\n";
+ $conf .= "FpingLocation=/usr/local/sbin/fping\n";
+ /* there's currently no fping6 (IPv6) dependency in the package, but if there was, the binary would likely also be in /usr/local/sbin */
+ $conf .= "Fping6Location=/usr/local/sbin/fping6\n";
+ $conf .= "ProxyMode=$Mode\n";
file_put_contents("/usr/local/etc/zabbix/zabbix_proxy.conf", $conf);
@@ -174,20 +210,21 @@
$lt[] = "{$wt}={$wv}";
}
file_put_contents("/boot/loader.conf", implode("\n", $lt) . "\n");
- chmod("/var/log/zabbix", 0777);
- chmod("/var/run/zabbix", 0777);
+ chmod("/var/log/zabbix", 0755);
+ chmod("/var/run/zabbix", 0755);
conf_mount_ro();
]]>
</custom_php_resync_config_command>
<custom_php_deinstall_command>
<![CDATA[
- exec("/usr/bin/killall zabbix_proxy");
+ exec("kill `cat /var/run/zabbix/zabbix_proxy.pid`");
exec("/bin/rm /usr/local/etc/rc.d/zabbix_proxy.sh");
exec("/bin/rm -r /var/log/zabbix/");
exec("/bin/rm -r /var/run/zabbix/");
+ exec("/bin/rm -r /var/db/zabbix/");
]]>
</custom_php_deinstall_command>
</packagegui> \ No newline at end of file