nSvcEvent and nSvcNotify traps

Ortner, Gerald Gerald.Ortner at gespag.at
Thu Jun 4 10:26:57 CEST 2009


Von: Meyer Jerome [mailto:Jerome.Meyer at baldata.ch] 
Gesendet: Mittwoch, 03. Juni 2009 16:27
An: Nagios-users at lists.sourceforge.net
Betreff: [Nagios-users] nSvcEvent and nSvcNotify traps

 

As someone an Idea?

 

When an event occurs, Nagios is sending the variable $NOTIFICATIONTYPE
within Email :

 

===email========================================

TEST***** Nagios *****

Notification Type: PROBLEM

Service: Ntp

Host: test1

Address: server_test

State: CRITICAL

Date/Time: Tue Jun 2 16:37:59 CEST 2009

Additional Info:

NTP CRITICAL: No response from NTP server

 

===checkcommand.cfg====================================

 

define command{

        command_name    notify-by-email

        command_line    /usr/bin/printf "%b" "TEST***** Nagios
*****\n\nNotificatio

n Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost:
$HOSTALIAS$\nAddress: $

HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$LONGDATETIME$\n\nAdditional Info

:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service
Alert: $HOSTALI

AS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

}

 

But it doesn't run with snmp trap ?????:

 

===checkcommand.cfg====================================

 

Define command{

command_line    $USER1$/send_trap server_test public $HOSTNAME$
$SERVICEDESC$ $SERVICESTATEID$ $SERVICEOUTPUT$ $NOTIFICATIONTYPE$

}

 

===/usr/local/nagios/libexec/send_trap==========

 

/usr/bin/snmptrap -v 2c -c $2 $1 '' NAGIOS-NOTIFY-MIB::nSvcEvent \

nSvcHostname s "$3" nSvcDesc s "$4" nSvcStateID i $5 nSvcOutput s "$6"
nSvcNotifyType i "$7"

 

echo `date` >>//etc/nagios/send_trap_result.txt

echo "Param. 1:"$1 >>/etc/nagios/send_trap_result.txt

echo "Param. 2:"$2 >>/etc/nagios/send_trap_result.txt

echo "Param. 3:"$3 >>/etc/nagios/send_trap_result.txt

echo "Param. 4:"$4 >>/etc/nagios/send_trap_result.txt

echo "Param. 5:"$5 >>/etc/nagios/send_trap_result.txt

echo "Param. 6:"$6 >>/etc/nagios/send_trap_result.txt

echo "Param. 7:"$7 >>/etc/nagios/send_trap_result.txt

echo "Param. 8:"$8 >>/etc/nagios/send_trap_result.txt

echo "Param. 9:"$9 >>/etc/nagios/send_trap_result.txt

echo "Param.10:"$10 >>/etc/nagios/send_trap_result.txt

echo "Param.11:"$11 >>/etc/nagios/send_trap_result.txt

echo "Param.12:"$12 >>/etc/nagios/send_trap_result.txt

echo "Param.13:"$13 >>/etc/nagios/send_trap_result.txt

echo `date` >>//etc/nagios/send_trap_result.txt

 

===send_trap.result.txt===========================

 

Tue Jun 2 16:42:52 CEST 2009

Param. 1:<server test>

Param. 2:<password>

Param. 3:test1

Param. 4:Ntp

Param. 5:0

Param. 6:NTP

Param. 7:OK:

Param. 8:Offset

Param. 9:unknown

Param.10:<server test>

Param.11:<server test>

Param.12:<server test>

Param.13:<server test>

Tue Jun 2 16:42:52 CEST 2009

 

I'd like to receive in my snmp trap the nSvcNotifyType like :

Notification Type: PROBLEM 

Notification Type: RECOVERY

...

 

Do a trap snmp sending only a nSvcEvent NOTIFICATION-TYPE or a
nSvcNotify NOTIFICATION-TYPE too ?????

What's the difference between them ????

Where should I find documentation about that ????

 

regards

jerome 

 

Hi !

NAGIOS_NOTIFY_MIB says :

nHostEvent  NOTIFICATION-TYPE

DESCRIPTION

    "The SNMP trap that is generated as a result of an event with the
host

    in Nagios."

 

nHostNotify NOTIFICATION-TYPE

DESCRIPTION

    "The SNMP trap that is generated as a result of an event requiring

    notification for a host in Nagios."

 

 

$NOTIFICATIONTYPE$ is a string and the MIB uses integer.#

http://nagios.sourceforge.net/docs/3_0/macrolist.html#notificationtype

 

Does send_trap cover that?

 

if not:

Today I finished a  small C program to translate the string into integer
and send traps (for nHostNotify and nSvcNotify) based on Nagiosmib 1.0.1

If you are interested in...  (maybe some parts need a bit of improvement
as I am not an advanced c programmer )

 

 

regards

Gerald

 





OOe. Gesundheits- und Spitals-AG
Techcenter, Hafenstrasse 47-51, 4020 Linz
DVR 2107870, ATU 51928204, Firmenbuchgericht: Landesgericht Linz, FN 210146 p


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090604/39164c53/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list