Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Script SNMP on event processing policy

Script SNMP on event processing policy

Scheduled Pinned Locked Moved Support
9 Posts 2 Posters 37.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    S
    Stardust
    wrote on last edited by
    #1

    Hi,

    I'm monitoring my backup servers with netxms by SNMP and I well receive the result of jobs on the event monitor but they are catched by SNMP_UNMATCHED_TRAP.
    But I don't know if that matters to do what I want to do;

    I would like to apply severity on the job results like:

    • Success -> Normal
    • Failed -> critical

     

    'Failed' and 'success' are in 3rd position on parameters varbind (I think):

    .1.3.6.1.4.1.31023.1.1.1.0.1 .1.3.6.1.4.1.31023.1.1.101 == '1109f400-0d24-4895-abb8-d298211314b2'; .1.3.6.1.4.1.31023.1.1.102 == 'BAckup Zabbix Serveur'; .1.3.6.1.4.1.31023.1.1.103 == 'Failed'; .1.3.6.1.4.1.31023.1.1.104 == ''
     
    What is the script that could catch the word 'Failed', 'Success' or else on Event Processing Policy?
     
    Or what is the simplest way to do that?

    Thanks

    1 Reply Last reply
    0
    • T
      T
      tomaskir
      wrote on last edited by
      #2

      Here is how I would do it:

      1. Create SNMP Trap with trap OID .1.3.6.1.4.1.31023.1.1.1.0.1
            From the trap, pass parameter from the OID .1.3.6.1.4.1.31023.1.1.103

      2. Create event for the SNMP trap. In event, you will get that parameter as %2
            You can use %2 to interpret job completion in the event message.

      3. Create 2x Event processing policy for this event (one for fail, one for success)
            In filtering script filter for the fail or success from event message.

      1 Reply Last reply
      0
      • S
        S
        Stardust
        wrote on last edited by
        #3

        Thanks but I would like to filtering the snmp containing the string ' Failed ' be marked as ' critical' (in red) and ' succeess ' in green in the event monitor. Is that possible?

        Moreover in the the Event processing policy I wanted a script that catch the word 'Failed' and send an email.

        What I've done:

        sub main()
        {

        if(%3 == 'Failed') return 1;

        else return 0;

        }

        -> I receive an email on the both cases (Fail or success)

        1 Reply Last reply
        0
        • T
          T
          tomaskir
          wrote on last edited by
          #4

          As I mentioned, create 2 Event Processing policies.

          1st will catch the event with 'Fail' in Event message; and create a critical alarm on the node and send the email.
          2nd will catch the event with 'Success' in Event message; terminate/resolve the previous alarm, and also send email.

          1 Reply Last reply
          0
          • S
            S
            Stardust
            wrote on last edited by
            #5

            @tomaskir said in Script SNMP on event processing policy:

            As I mentioned, create 2 Event Processing policies.

            1st will catch the event with 'Fail' in Event message; and create a critical alarm on the node and send the email.
            2nd will catch the event with 'Success' in Event message; terminate/resolve the previous alarm, and also send email.

            Thank you for your help but i'm stuck right here.
            How can I catch the event with 'Fail' in the event? What is the script code?

            What I've done:
            sub main()
            {
            transport = CreateSNMPTransport(FindObject(".1.3.6.1.4.1.31023.1.1.1.0.1"));    // Create SNMP transport for node

             value = SNMPGetValue(transport, ".1.3.6.1.4.1.31023.1.1.103");
             
             if(value == "Failed") return 1;
             
             else retun 0;
             
             }

            PS: I forgot to mention that I couldn't find the OID by the MIB Browser, that's why that OID is catch by the trap 'SNMP_UNMATCHED_TRAP' (is that important for that I want to do?)

            1 Reply Last reply
            0
            • T
              T
              tomaskir
              wrote on last edited by
              #6

              Create your own event for your SNMP trap.
              In that event %2 and %3 will be accessible for the parameters you map from your Trap.

              Dont use the default SNMP_UNMATCHED_TRAP event.

              Then create your own EPP to catch that event.
              You can test and just see if you catch it properly without filtering for FAIL/SUCCESS.

              Then when you have that working, you can start playing with the scripting.

              Do it step-by-step, dont do everything at once, because you then dont know what isnt working.

              1 Reply Last reply
              0
              • T
                T
                tomaskir
                wrote on last edited by
                #7

                Come and visit us in the support IRC channel, it will be much faster to get this resolved 🙂

                1 Reply Last reply
                0
                • S
                  S
                  Stardust
                  wrote on last edited by
                  #8

                  On #Netxms ?

                  1 Reply Last reply
                  0
                  • S
                    S
                    Stardust
                    wrote on last edited by
                    #9

                    That script worked for me:

                    sub main()
                    {
                        if ( index($event->message, "Success"))return 1;
                             else return 0;
                     }

                    1 Reply Last reply
                    0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    Powered by NodeBB Contributors
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups