SNMP Traps Nagios Download


Send SNMP Traps in Nagios

Passive check is used in SNMP Traps Nagios Download notifications, ie the device notifies Nagios about the events. To create a trap on the device, read the documentation: SNMP Traps notification.
To receive and interpret SNMP Traps requires the following tools:

1) Net-SNMP  snmptrapd  SNMP Trap receive service (http://www.net-snmp.org/)

2) SNMPTTSNMP Trap messages interpretation service (http://snmptt.sourceforge.net/)

Net-SNMP snmptrapd utility configured as follows:

  • /etc/snmp/snmptrapd.conf

traphandle default /usr/sbin/snmptthandler
disableAuthorization yes
thus, the incoming SNMP Traps redirected in  /usr/sbin/snmptt handler of SNMPTT translator

SNMPTT translator is used for the collection of information received in the SNMP Trap.
For processing of Traps with SNMPTT service,  SNMP Trap OID must be converted with a mib file into a file with extension .conf conversion utility snmpttconvertmib and plugged to a file  in SNMP Traps Nagios Download

/etc/snmp/snmptt.conf:

[TrapFiles]
snmptt_conf_files = <<END
/etc/snmp/snmptt.conf

Content of SNMP.Conf File after Conversion Into Vutlan.Mib:

/etc/snmp/snmptt.conf
EVENT ctlUnitTrapNotification .1.3.6.1.4.1.39052.1.5 "Status Events" Normal
FORMAT $*
EXEC /usr/lib/nagios/plugins/eventhandlers/submit_check_result $r TRAP 1 "$*"
SDESC
Vutlan EMS trap
Variables:
EDESC
ie all Trap messages are sent to the script  submit_check_result, which interprets the state of the element in the logic, formats the message and sends it to the Nagios passive checks pipe:

/etc/snmp/snmptt.conf
#!/bin/sh

# SUBMIT_CHECK_RESULT
# Written by Ethan Galstad (egalstad@nagios.org)
# Last Modified: 02-18-2002
# This script will write a command to the Nagios command
# file to cause Nagios to process a passive service check
# result. Note: This script is intended to be run on the
# same host that is running Nagios. If you want to
# submit passive check results from a remote machine, look
# at using the nsca addon.
# Arguments:
# $1 = host_name (Short name of host that the service is
# associated with)
# $2 = svc_description (Description of the service)
# $3 = return_code (An integer that determines the state
# of the service check, 0=OK, 1=WARNING, 2=CRITICAL,
# 3=UNKNOWN).
# $4 = plugin_output (A text string that should be used
# as the plugin output for the service check)
 
echocmd="/bin/echo"
CommandFile="/var/spool/nagios/cmd/nagios.cmd"

# get the current date/time in seconds since UNIX epoch
datetime=`date +%s`

name=$4
name=${name#*name: }
name=${name%%','*}
name=`echo -n $name`

state=$4
state=${state#*state:}
state=${state%%','*}
state=`echo -n $state`

status="UNKNOWN"

# check state
case "$state" in
        normal| on | off)
            #echo "OK"
            status=0
            ;;

        warning | 'low warning' | 'high warning')
            #echo "WARNING"
            status=1
            ;;

        alarm | 'low alarm' | 'high alarm')
            #echo "CRITICAL"
            status=2
            ;;

        *)
            #echo "UNKNOWN"
            status=3

esac

# check test and reset to OK
if [[ $4 =~ "test message" ]] ; then
    #echo "OK"
    status=0
fi

# create the command line to add to the command file
cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$name;$status;$4" #$2;$3;$4"

# append the command to the end of the command file
`$echocmd $cmdline >> $CommandFile`
This script defines the name, set when created the SNMP Trap notification in the master module, as well as state of the element, which led to the triggering logic.

In the Nagios configuration file, you must add a template for passive testing and tie this pattern, for example, with a group of hosts:

/etc/nagios/objects/schosts.cfg
# Trap
define service{
        name                    trap-service
        use                     generic-service
        register                0
        is_volatile             1
        check_command           check-host-alive     ;Used to reset the status to OK when 'Schedule an immediate check of this service' is selected
        flap_detection_enabled  0                    ; Flap detection is disabled
        process_perf_data       0                    ; Do not Process performance data
        max_check_attempts      1
        normal_check_interval   1
        retry_check_interval    1
        passive_checks_enabled  1
        active_checks_enabled   0                    ; Prevent active checks from occuring as we are only using passive checks
        check_period            none
        notification_interval   31536000
        notification_options    w,u,c                ; Notify on warning, unknown and critical
        contact_groups          admins
}

define service{
        use                     trap-service
        service_description     Trap1
        hostgroup_name          sc-hosts
}

Download SNMP Nagios Microsoft and Linux :

SNMP Nagios Microsoft 
Free Driver
SNMP Nagios Linux
Free Driver


Trap1 Nagios



when you send a text message to Nagios, some time service status must be changed:
To send notifications, you must create logic circuits in the master unit interface, the results associated with sending SNMP Trap1 notifications with SNMP Trap Nagios Download.

Discussion: