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. Alarm key SERVICE_DOWN_ => Function or operation argument is not an object

Alarm key SERVICE_DOWN_ => Function or operation argument is not an object

Scheduled Pinned Locked Moved Support
11 Posts 4 Posters 52.2k 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.
  • B
    B
    BigBlue
    wrote on last edited by
    #1

    Hi,

    I tried a NXSL script to display the content of all alarms.
    It works for MAC_ADDRESS_CHANGED_.* for example:

    	alarm = FindAlarmByKeyRegex("MAC_ADDRESS_CHANGED_.*");
    	println alarm->message;
    
    MAC address for interface unknown changed from XX:XX:XX:XX:XX:XX to XX:XX:XX:XX:XX:XX
    *** FINISHED ***
    

    But it doesn't work for SERVICE_DOWN_?

    	alarm = FindAlarmByKeyRegex("SERVICE_DOWN_.*");
    	println alarm->message;
    
    Error 14 in line 64: Function or operation argument is not an object
    

    I must be doing it wrong...

    Can you help me?

    Thanks
    BB

    1 Reply Last reply
    0
    • Z
      Z
      Zebble
      wrote on last edited by
      #2

      alarm = FindAlarmByKeyRegex("SERVICE_DOWN_.*");

      works for me, but only if there are alarms that have SERVICE_DOWN_.  If there aren't any, you'll get a "Function or operation argument is not an object" if you try to println alarm->message because alarm isn't an object.  Alarm would be set to NULL in this case, so best to check for this:

      if (alarm != NULL)
        println alarm->message;

      1 Reply Last reply
      0
      • B
        B
        BigBlue
        wrote on last edited by
        #3

        ok, thanks.

        Sorry for my inexperience with NXSL
         :-[

        BB

        1 Reply Last reply
        0
        • B
          B
          BigBlue
          wrote on last edited by
          #4

          But, I think this is not the right way...

          a_key = %("NODE_DOWN_.*","SERVICE_DOWN_.*","IF_DOWN_.*","IF_UNEXP_UP_.*","BAD_NETMASK_.*","SCRIPT_ERR_.*","DCI_STATUS_.*","DC_THRESHOLD_.*","DCTTHR_.*","SYS_THREAD_HANG_.*","MAINTENANCE_MODE_.*","AGENT_UNREACHABLE_.*","SNMP_UNREACHABLE_.*","SYS_LDAP_SYNC_ERROR_.*","SYS_AGENT_LOG_PROBLEM_.*","SYS_AGENT_LOCAL_DATABASE_PROBLEM_.*","MAC_ADDRESS_CHANGED_.*","BAD_NETMASK_.*","ROUTING_LOOP_.*","SW_PKG_.*");
          
          for (i = 0; i < a_key->size; i++ )
          {
          	alarm = FindAlarmByKeyRegex(a_key[i]);
          	if (alarm != NULL)
          	{
          		println  (alarm->key) . (alarm->message) . "\n";
          	}
          }
          
          
          NODE_DOWN_0x000099C6Node down
          
          SCRIPT_ERR_Template::Zone Proxy::108_Error in line 1: syntax error, unexpected $end, expecting ';'Script (Template::Zone Proxy::108) execution error: Error in line 1: syntax error, unexpected $end, expecting ';'
          
          MAC_ADDRESS_CHANGED_0x0001EDB7_1MAC address for interface unknown changed from XX:XX:XX:XX:XX:XX to XX:XX:XX:XX:XX:XX
          
          
          *** FINISHED ***
          
          Result:
          

          I have a lot of errors and "alarm->message" does not return all the information.
          Do you know if it is possible to get about the same result in "Alarm Browser"?

          1 Reply Last reply
          0
          • Z
            Z
            Zebble
            wrote on last edited by
            #5

            Your script works without issue on my end.  I'm using 3.8.314.

            1 Reply Last reply
            0
            • B
              B
              BigBlue
              wrote on last edited by
              #6

              I am also in the 3.8.314 version  😕

              1 Reply Last reply
              0
              • F
                F
                Filipp Sudanov
                wrote on last edited by
                #7

                The script in your example returns only one alarm for each key. E.g. if you have several node with NODE_DOWN alarm, only one will be returned.

                Can you give some information on what you are trying to achieve as the final result?

                1 Reply Last reply
                0
                • B
                  B
                  BigBlue
                  wrote on last edited by
                  #8

                  Hi,

                  I'm trying to get the logs as displayed in the "Alarm Browser" window.
                  As I said, this may not be the right way to do it  :-[

                  I have now gone another way, exporting the alarms when they appear using the "Event Processing Policy" and an associated "Action".
                  But then I'll have to manage the acknowledgements myself ... etc...

                  BB

                  1 Reply Last reply
                  0
                  • V
                    V
                    Victor Kirhenshtein
                    wrote on last edited by
                    #9

                    Hi,

                    you can access all alarms via "Entire Network" or "Infrastructure Services" objects. FOr example, the following script will print all alarm messages:

                    for(a : FindObject(1)->alarms)
                    {
                    	println a->message;
                    }
                    

                    Best regards,
                    Victor

                    1 Reply Last reply
                    0
                    • B
                      B
                      BigBlue
                      wrote on last edited by
                      #10

                      hi,

                      Thank you, this has inspired me a lot!

                      Now I can display the id, name and message of each alarm.

                      for (n : GetAllNodes())
                      {
                      	for(a : n->alarms)
                      	{
                      		println n->id . "\t" . n->name . "\t" . a->message;
                      	}
                      }
                      

                      But I don't know how to display the date ?

                      Thanks for your help.
                      BB

                      1 Reply Last reply
                      0
                      • B
                        B
                        BigBlue
                        wrote on last edited by
                        #11

                        oh!

                        I've got it:

                        		oldestAlarmTime = min(oldestAlarmTime, a->creationTime);
                        		println n->id . "\t" . n->name . "\t" . a->message . "\t" . strftime("%Y-%m-%d %H:%M", a->creationTime);
                        

                        Thanks to all.

                        BB

                        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