Results 1 to 10 of 10

Thread: SNMP Traps Link UP/DOWN

  1. #1
    Join Date
    Sep 2009
    Posts
    5

    Default SNMP Traps Link UP/DOWN

    Bonjour à tous,
    j'ai configuré un switch HP Procurve pour qu'il envoi des traps snmp vers mon serveur nagios.
    J'ai ensuite configuré un host pour le switch puis un service lié aux traps snmp Link UP/DOWN, ainsi qu'une notification.
    Tout fonctionne parfaitement, je reçois bien les traps et je suis bien averti dès que nagios reçoit une traps Link DOWN.
    Le problème est que je ne veux surveiller que 2 ou 3 ports sur mon switch.
    Aujourd'hui dès que je débranche un càable de mon switch , j'en suis averti parce que mon switch envoi systématiquement une trap snmp link DOWN.

    A-t-il possible de lancer une action de vérification check_snmp sur un port bien précis à chaque réception d'une trap link DOWN et de lancer une notification si le résultat de check_snmp et CRITICAL.

    Merci de votre aide.

  2. #2
    Join Date
    Jul 2009
    Location
    Los Angeles, CA, USA
    Posts
    351

    Default

    Event handlers might do it for the trap
    Specializing in Open Source Monitoring Solutions
    Nagios / Cacti / Centreon / SNMP

  3. #3
    Join Date
    Sep 2009
    Posts
    5

    Default

    Who setup a Event handler for the linkUP/DOWN trap ?

  4. #4
    Join Date
    Jul 2009
    Location
    Los Angeles, CA, USA
    Posts
    351

    Default

    In your service for the trap........ edit it, then click on "Data Processing"

    In your event handler you can pass MACRO's to event handler such as $SERVICESTATE$ to indicate your service state:http://nagios.sourceforge.net/docs/3...l#servicestate

    From your "eventhandler" you can submit a service check as an external command so your "check_snmp" command will fire as a result.

    I think that it is possible. There is a lot power in eventhandlers such as the ability to test SOFT/HARD, "NO OF ATTEMPTS", OK/CRITICAL/UKNOWN.............. you just have to pass the right MACRO to the eventhandler and use a switch/case to filter the right event.

    I hope that this makes sense but there are probably other ways to do it, but this is how I would approach your need.
    Specializing in Open Source Monitoring Solutions
    Nagios / Cacti / Centreon / SNMP

  5. #5
    Join Date
    Sep 2009
    Posts
    5

    Default

    This is my service config:

    define service{
    host_name SW-INFO2
    service_description Port C1
    use generic-service
    is_volatile 1
    check_command check_snmp!ifOperStatus.49!3!2!public!
    max_check_attempts 1
    normal_check_interval 10
    retry_check_interval 10
    active_checks_enabled 0
    passive_checks_enabled 1
    check_period 24x7
    event_handler check_snmp!ifOperStatus.49!3!2!public!
    event_handler_enabled 1
    flap_detection_enabled 1
    notification_interval 10
    notification_period 24x7
    notification_options w,c
    notifications_enabled 1
    }

    An this service is link with snmp traps linkUP linkDOWN.

    I'm not understand why i receive a notification when i unplug port number 1 for example.

  6. #6
    Join Date
    Jul 2009
    Location
    Los Angeles, CA, USA
    Posts
    351

    Default

    You are doing too much at first.

    1) Normally people will use a "check_dummy" (check command) for a TRAP service. You are using actual service (check_snmp) for your check command and not (check_dummy)

    You have to realize that this service is just a dumb service. It gets its power from the passive checks, when a trap is fired up from SNMPTRAPD.

    2) Your event handler will be fired too many times. It will be fired for every trap.

    3) Your ifDown trap (.1.3.6.1.6.3.1.1.5.3) is a CRITICAL trap that will take the service into "CRITICAL" state.

    If you do not want "CRITICAL" you can go to Serivices->Traps->.1.3.6.1.6.3.1.1.5.3 and change it from CRITICAL to OK
    Specializing in Open Source Monitoring Solutions
    Nagios / Cacti / Centreon / SNMP

  7. #7
    Join Date
    Sep 2009
    Posts
    5

    Default

    Thanks for you reply.
    I want to be notified immediately the port number 49 is down because it's a important connection.

  8. #8
    Join Date
    Jul 2009
    Location
    Los Angeles, CA, USA
    Posts
    351

    Default

    Ok, Im sorry. There is a way I think thru Service Group dependency checking, but I am fuzzy on that.

    Basically, if you get a trap, then you want to immediately check that port.

    Your event handler is stupid, its just a way to run a program. If you run SNMP check, it will work, but it doesn't check the results. It justs runs. You could send a email, delete a file, it doesn't matter....... its just a way to run something.

    What you want to do is write a small PERL/SHELL script like
    check_port49.pl (psudeo code):

    1) get snmp value for port 49

    2) if fine exit else

    3) if down then /bin/echo "[$datetime] PROCESS_SERVICE_CHECK_RESULT;$this_host;check_49;$ status;$arguments_line" >> nagios.cmd

    Then create a passive service for "check_49" with the the max_attempts to 1

    There are alot of was to do this.


    SIMPLE WAY: CHECK 49 EVERY 1 minutes
    Last edited by michaelwjoyner; 10th September 2009 at 03:04.
    Specializing in Open Source Monitoring Solutions
    Nagios / Cacti / Centreon / SNMP

  9. #9
    Join Date
    Sep 2009
    Location
    Strasbourg (France)
    Posts
    39

    Default

    Mkael29,

    As-tu résolu ton problème ? Je suis très intéressé.

    Slts
    Lal

  10. #10
    Join Date
    Sep 2009
    Location
    Strasbourg (France)
    Posts
    39

    Default

    Hello,

    J'ai une solution que j'ai trouvé sur le forum d'HP.

    Il faut simplement dire par interface au niveau de la Mib du commutateur que l'on veut ou pas la trap link up / down :

    La Mib qui va bien est la suivante :

    1.3.6.1.2.1.31.1.1.1.14

    donc si on ne souhaite pas de remontée de trap pour link up / down du port 1 il faut passer la commande :

    setmib 1.3.6.1.2.1.31.1.1.1.14.1 -i 2

    l'activation se faisant par :

    setmib 1.3.6.1.2.1.31.1.1.1.14.1 -i 1

    Slts
    Lal

Similar Threads

  1. SNMP traps
    By michaelwjoyner in forum Setup
    Replies: 1
    Last Post: 24th July 2009, 21:31
  2. SNMP Traps
    By titi563 in forum Centreon Project
    Replies: 7
    Last Post: 19th May 2009, 10:44
  3. Les traps SNMP
    By thomascentreon in forum Plugins
    Replies: 5
    Last Post: 14th August 2008, 15:30
  4. Traps SNMP
    By Nothing in forum Setup
    Replies: 0
    Last Post: 31st March 2008, 17:36
  5. Traps snmp XP
    By djkevin47 in forum Plugins
    Replies: 2
    Last Post: 27th August 2007, 15:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •