Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfSense-pkg-zabbix-proxy: Add SNMP Trap Monitoring options #347

Merged
merged 3 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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