Skip to content

Commit

Permalink
Merge pull request #347 from dbaio/zabbix_traps
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgarga committed May 9, 2017
2 parents 07a95b0 + ae47b1f commit 6f54546
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 5 deletions.
3 changes: 1 addition & 2 deletions net-mgmt/pfSense-pkg-zabbix-proxy/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-zabbix-proxy
PORTVERSION= 0.8.9
PORTREVISION= 3
PORTVERSION= 0.9.0
CATEGORIES= net-mgmt
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,34 @@ function php_deinstall_zabbix_proxy_lts() {
function validate_input_zabbix_proxy_lts($post, &$input_errors) {
if (isset($post['proxyenabled'])) {
if (!preg_match("/\w+/", $post['server'])) {
$input_errors[] = "Server field is required.";
$input_errors[] = "'Server' field is required.";
}

if (!is_numericint($post['serverport'])) {
$input_errors[] = "'Server Port' value is not numeric.";
} elseif ($post['serverport'] < 1 || $post['serverport'] > 65535) {
$input_errors[] = "You must enter a valid value for 'Server Port'.";
$input_errors[] = "Enter a valid value for 'Server Port'.";
}

if (!preg_match("/\w+/", $post['hostname'])) {
$input_errors[] = "Hostname field is required.";
$input_errors[] = "'Hostname' field is required.";
}

if (!is_numericint($post['configfrequency'])) {
$input_errors[] = "'Config Frequency' value is not numeric.";
}

if (!is_numericint($post['trappertimeout'])) {
$input_errors[] = "'Trapper Timeout' value is not numeric.";
} elseif ($post['trappertimeout'] < 1 || $post['trappertimeout'] > 300) {
$input_errors[] = "Enter a valid value for 'Trapper Timeout'.";
}

if (!is_numericint($post['starttrappers'])) {
$input_errors[] = "'Start Trappers' value is not numeric.";
} elseif ($post['starttrappers'] > 1000) {
$input_errors[] = "Enter a valid value for 'Start Trappers'.";
}
}
}

Expand Down Expand Up @@ -117,6 +129,16 @@ function sync_package_zabbix_proxy_lts() {
$TLSPSKFile = "TLSPSKFile=/usr/local/etc/zabbix3/zabbix_proxy.psk";
}

$StartSNMPTrapper = $zbproxy_config['startsnmptrapper'];
$SNMPTrapperFile = $zbproxy_config['snmptrapperfile'] ?: "/tmp/zabbix_traps.tmp";
$TrapperTimeout = $zbproxy_config['trappertimeout'] ?: "300";

if ($StartSNMPTrapper) {
$StartTrappers = $zbproxy_config['starttrappers'] ?: "5";
} else {
$StartTrappers = "0";
}

$zbproxy_conf_file = <<< EOF
Server={$zbproxy_config['server']}
ServerPort={$zbproxy_config['serverport']}
Expand All @@ -138,6 +160,10 @@ TLSAccept={$TLSAccept}
{$TlsKEYfile}
{$TLSPSKIdentity}
{$TLSPSKFile}
StartSNMPTrapper={$StartSNMPTrapper}
SNMPTrapperFile={$SNMPTrapperFile}
TrapperTimeout={$TrapperTimeout}
StartTrappers={$StartTrappers}
{$AdvancedParams}
EOF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,57 @@
<cols>50</cols>
<description></description>
</field>
<field>
<name>SNMP Trap Monitoring</name>
<type>listtopic</type>
</field>
<field>
<fielddescr>Start SNMP Trapper</fielddescr>
<fieldname>startsnmptrapper</fieldname>
<description>If enabled, SNMP trapper process is started.</description>
<type>select</type>
<default_value>0</default_value>
<options>
<option><name>Enabled</name><value>1</value></option>
<option><name>Disabled</name><value>0</value></option>
</options>
</field>
<field>
<fielddescr>SNMP Trapper File</fielddescr>
<fieldname>snmptrapperfile</fieldname>
<description>
<![CDATA[
Temporary file used for passing data from SNMP trap daemon to the proxy.<br/>
Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file.<br/>
]]>
</description>
<default_value>/tmp/zabbix_traps.tmp</default_value>
<type>input</type>
<size>150</size>
</field>
<field>
<fielddescr>Trapper Timeout</fielddescr>
<fieldname>trappertimeout</fieldname>
<description>Specifies how many seconds trapper may spend processing new data. (Default: 300) (Range: 1-300)</description>
<default_value>300</default_value>
<type>input</type>
<size>3</size>
</field>
<field>
<fielddescr>Start Trappers</fielddescr>
<fieldname>starttrappers</fieldname>
<description>
<![CDATA[
Number of pre-forked instances of trappers.<br/>
Trappers accept incoming connections from Zabbix sender and active agents.<br/>
Default: 5<br/>
Range: 0-1000<br/>
]]>
</description>
<default_value>5</default_value>
<type>input</type>
<size>4</size>
</field>
<field>
<fielddescr>Advanced Parameters</fielddescr>
<fieldname>advancedparams</fieldname>
Expand Down

0 comments on commit 6f54546

Please sign in to comment.