Configuring Traps
The following sections describe configuring traps via NET-SNMP.
Configuring Traps for Recommended OIDs
To configure sending traps for recommended OIDs, you must install the NET-SNMP utilities package.
$ sudo yum install net-snmp-utils
SNMPv2 Traps
For SNMPv2 traps to be sent from the ISR host, edit the
"/etc/snmp/snmpd.local.conf" file and add the following configuration settings
for the default NET-SNMP network interface and host resource notifications.
Then restart the snmpd service.
# default NET-SNMP trap configs
# receiving IP address
trap2sink <NMS_IP_address>
# SNMPv3 user for internal queries
iquerySecName isrsnmp
agentSecName isrsnmp
# enable default monitoring
defaultMonitors yes
linkUpDownNotifications yes
Note:
For more information on the default network and resource coverage with NET-SNMP, execute the man snmpd.conf command and read "DisMan Event MIB".SNMPv3 Traps
SNMPv3 traps require a slight change in the
/etc/snmp/snmpd.local.conf
file only and the remaining configuration values remain unchanged.
Note:
When you enable SNMPv3 traps, you must restart the snmpd service.# default NET-SNMP trap configs
# receiving IP address
trapsess -l authPriv -u isrsnmp -a MD5 -A <authPassword> -x DES -X <PrivPassword><NMS_IP_address>
# SNMPv3 user for internal queries
iquerySecName isrsnmp
agentSecName isrsnmp
# enable default monitoring
defaultMonitors yes
linkUpDownNotifications yes
Monitoring MySQL Database Replication On the Index Hosts
The following sections offer examples to configure NET-SNMP for monitoring the MySQL Server error log and sending traps for certain slave database events. Specifically, slave IO errors such as a lost connection with master and slave SQL errors from failed statements are rolled into a trap with a "MySQL replication error" description along with the "/var/log/mysqld.log" file that posted the error.
Configuring NET-SNMP For Monitoring MySQL Server Error Logs
Add the following lines to the "snmpd.local.conf file on the Index hosts:
logmatch mysqlReplicationNoSlave /var/log/mysqld.log 60 Error reading relay log event for channel
logmatch mysqlReplicationNoServer /var/log/mysqld.log 60 \[ERROR\] Slave I\/O for channel
logmatch mysqlReplicationSqlError /var/log/mysqld.log 60 \[ERROR\] Slave SQL for channel
monitor -r 60 -o logMatchFileName "MySQL replication error" != logMatchCurrentCount -u isrsnmp
Restart the snmpd process.
$ systemctl restart snmpd
Configuring SNMPD to Read MySQL Server Error Log
By default, SELinux does not allow NET-SNMP's "snmpd" process to read the MySQL Server default "/var/log/mysqld.log" file. There are some tools available with snmpd to add the proper configuration, specifically the "audit2allow" command-line tool. This tool adds an SELinux "allow" rule based on the logged event for the "snmpd" process being refused "read" and "open" access.
Monitoring the ISR with Recording Capacity Exceeded
To configure monitoring when the ISR's recording capacity has been exceeded, add the following lines to the "snmpd.local.conf" file on the RSS hosts:
logmatch recorderCapacityExceeded /opt/isr/logs/recorder/recorder.log 120 no channels available to take this call
logmatch systemCapacityExceeded /opt/isr/logs/recorder/recorder.log 120 no channels available to take this call
monitor -r 60 -o logMatchName -o logMatchFileName "RSS application error" != logMatchCurrentCount -u isrsnmp
Note:
Add the last line specifically to send a trap when the ISR exceeds capacity, or the Recorder and Converter processes have restarted. For more information, see Recommended ISR RSS SNMP Configuration.