Announcement

Collapse

New version of forum

Hi,

As you can see, the forum has been updated.

We took advantage of this migration to change the theme of the forum and to reorganize sections.

These new sections allow better classify subjects discussed. The old topics have been classified in the "Archives" section of the forum and remains accessible.

We reclassified the recent topics (since the 1st of July) in the news sections. To find your topics, please use search menu. We will reclassify active topics from Archives section to the new ones frequently.

Enjoy reading and discussions
See more
See less

SNMP Traps Link UP/DOWN

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Event handlers might do it for the trap
    Specializing in Open Source Monitoring Solutions
    Nagios / Cacti / Centreon / SNMP

    Comment


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

      Comment


      • #4
        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

        Comment


        • #5
          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.

          Comment


          • #6
            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

            Comment


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

              Comment


              • #8
                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, 02:04.
                Specializing in Open Source Monitoring Solutions
                Nagios / Cacti / Centreon / SNMP

                Comment


                • #9
                  Mkael29,

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

                  Slts
                  Lal

                  Comment


                  • #10
                    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

                    Comment

                    Working...
                    X