PDA

View Full Version : [ubuntu] 12.04 Server - Nagios & passive check



mascir
August 16th, 2012, 01:24 PM
Hi All,

so, i will configure my Nagios in order to accept SNMP trap from my network elements. I talk about Zyxel router and switch. I have configured one switch in order to test the service.

In my fw (logs) behind the switch i saw the trap in outgoing traffic. This mean that the element configuration working fine.

So, how i can configure the "host" on my nagios in order to accept the trap?

In the Nagios docs it's a little bit confuse :)

on my Nagios file i have this following host config:

define host{
use generic-switch
host_name Customer Sw DC
alias Zyxel GS1510-24
address X.X.X.X
hostgroups Customer Sw
icon_image switch.png
icon_image_alt Customer Zyxel Sw DC
statusmap_image switch.png
2d_coords 50,600
}

thanx in advance :)

koenn
August 16th, 2012, 11:08 PM
afaik, Nagios doesn't handle SNMP traps by itself. It can (actively) query SNMP, but doesn't listen for incoming msgs.

I think you can make Nagios accept SNMP trap msgs in a passive service config, but you probably have to install an additional somtehing that listens for SNMP traps.

In any case, on the Nagios side this is likely to be a (passive) service definition. A simple host def ain't gonna cut it; those are only for connectivity checks, and to associate services with.

Google for something like "nagios SNMP trap howto"

If you don't understand "service" in a Nagios context, learn about that first - you're going to need it for everything beyound pinging a host to see if its up or down.

mascir
August 16th, 2012, 11:24 PM
afaik, Nagios doesn't handle SNMP traps by itself. It can (actively) query SNMP, but doesn't listen for incoming msgs.

I think you can make Nagios accept SNMP trap msgs in a passive service config, but you probably have to install an additional somtehing that listens for SNMP traps.

In any case, on the Nagios side this is likely to be a (passive) service definition. A simple host def ain't gonna cut it; those are only for connectivity checks, and to associate services with.

Google for something like "nagios SNMP trap howto"

If you don't understand "service" in a Nagios context, learn about that first - you're going to need it for everything beyound pinging a host to see if its up or down.


thanx a lot...

i forgot to put into the 1st message the service config:

define service{
name passive-service
use generic-service
host_name Customer Sw DC
active_checks_enabled 0
passive_checks_enabled 1
flap_detection_enabled 0
register 0
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
check_freshness 0
contact_groups admins
notification_options w,u,c,r
stalking_options w,c,u
notification_interval 120
check_command check_dummy!0
}

also this config needs of a external listner for the trap? If yes...suggestion? I repeat, the official docs isn't clear...for me.

mascir
August 17th, 2012, 08:51 PM
ok...i found a cool tutorial on the web:

http://nagios.sourceforge.net/download/contrib/documentation/misc/NSCA_Setup.pdf

i followed every step, but before i compile the NSCA plugin i have installed xinetd.

so, after i tested the NSCA config i have had problem with nagios.


>Configuring Nagios
>If everything is running smoothly so far, the final step would be to create the service to process your
>passive checks in Nagios. I will show how to create a standard passive check service, but as with
>everything in Nagios, it should be customized for your own needs.
>We are going to use the check_dummy as our check_command in the service we must define that
>command as well. Open up Nagios config file containing your check commands, if you are using
>minimal.cfg, this will be in here. Enter the following lines in the commands section:
define command{
command_name check_dummy
command_line $USER1$/check_dummy $ARG1$
}

done in /usr/local/nagios/etc/objects/commands.cfg

>Next, we will create a service template for the passive checks. Enter the following lines at the bottom
>of the services section:
# Define a passive check template
define service{
use generic-service
name passive_service
active_checks_enabled 0
passive_checks_enabled 1 # We want only passive checking
flap_detection_enabled 0
register 0 # This is a template, not a real service
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
check_freshness 0
check_command check_dummy!0
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
stalking_options w,c,u
}

done in /usr/local/nagios/etc/objects/switch.cfg

>After, we can create actual services to match our service checks being passed by NSCA. Keep in mind that the
>service_description must match the svc_description received in the nsca packet, in our above example using >send_nsca, the svc-description was “TestMessage”. I will continue building a service check using that example:

define service{
use passive_service
service_description TestMessage
host_name localhost
}

done in /usr/local/nagios/etc/objects/switch.cfg

>Restart the Nagios daemon so that it loads the updates in your config file. If you have installed Nagios as a service >you
>can use:
>service nagios restart

WARNING!

Warning: Duplicate definition found for service 'passive_service' (config file '/usr/local/nagios/etc/objects/switch.cfg', starting on line 113)
Error: Could not add object property in file '/usr/local/nagios/etc/objects/switch.cfg' on line 115.
Error processing object config files!


following the line....


define service{
use generic-service
name passive_service <- ****line 115****
active_checks_enabled 0
passive_checks_enabled 1 # We want only passive checking
flap_detection_enabled 0
register 0 # This is a template, not a real service
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
check_freshness 0
check_command check_dummy!0
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
stalking_options w,c,u
}


# PASSIVE CHECK SERVICE FROM NSCA

define service{
use passive_service
service_description TestMessage
host_name localhost
}



Can someone help me?

thanx in advance

Massimo

sandyd
August 20th, 2012, 06:11 AM
BTW, have a look at zabbix

supports traps without all this config mess.

Just adding the ip in the 'hosts' box will enable the trap

koenn
August 20th, 2012, 06:15 PM
You appear to be getting more and more lost. Maybe you do have to take a look at zabbix.





also this config needs of a external listner for the trap?
Apperently, yes. From what I see on the web, it's supposed to work like this :

snmp device sends trap --> snmptrapd --> snmptt ("Trap Translator") -> Nagios passive service
snmptratd and snmptt are in the repos, I think.


ok...i found a cool tutorial on the web:
http://nagios.sourceforge.net/downlo...NSCA_Setup.pdf
That's NSCA. That tutoral will tell you a lot about how passive checks work, but NSCA is not SNMP (although NSCA and SNMP traps are conceptually very much alike, i.e. they're both about Agents submitting results to a Nagios passive service)


Warning: Duplicate definition found for service 'passive_service' (config file '/usr/local/nagios/etc/objects/switch.cfg', starting on line 113)
Error: Could not add object property in file '/usr/local/nagios/etc/objects/switch.cfg' on line 115.
Error processing object config files!
That's because you've given your service and its template the same name -> duplicate name -> Nagios complains.

-----
EDIT

I might have misinterpreted your posts so maybe my duplicate name explanation isn't correct;

look for possible duplicates with something like


grep -r "passive_service" /usr/local/nagios/


-----

I think you don't understand Nagios very well. Here's a Nagios for Dummies tutorial that might be of help :
http://users.telenet.be/mydotcom/howto/nagios/index.html


It also has some (incomplete) notes on Nagios With SNMP and SNMP traps