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. Adding details to table threshold alarm / no SNMPReadTable function

Adding details to table threshold alarm / no SNMPReadTable function

Scheduled Pinned Locked Moved Support
2 Posts 1 Posters 24.9k 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.
  • M
    M
    mk
    wrote on last edited by
    #1

    Right now I get alarm messages like

    Threshold activated on table "prtAlert" row 1 (12)

    but I'd prefer to get messages like

    Threshold activated on table "prtAlert": YELLOW CARTRIDGE LOW

    i.e. it should pull the message from a cell in row 1 in the table. A screenshot of this table is attached to this post.


    I'm trying to put together a script to add more information to the SYS_TABLE_THRESHOLD_ACTIVATED event message. The script is called Table_Alarm_Description, so I added %[Table_Alarm_Description] to the Message field in the Generate alarm action of event number 18 (Generate alarm on table threshold violation). The script gets called when the alarm is triggered and all is well in that regard.

    This is the script I'm using:

    sub main()
    {
    	table = AgentReadTable($node, $event->parameters[2]);
    	if (table == null)
    	{
    		return "[AgentReadTable(" . $node->name . ", " . $event->parameters[2] . ") failed.]";
    	}
    	colNum = 1;
    	alertMsg = table->get($event->parameters[4], colNum);
    	if (alertMsg == null)
    	{
    		return "[table->get(" . $event->parameters[4] . ", " . colNum . ") failed.]";
    	}
    	return alertMsg;
    }
    

    I'm seeing that AgentReadTable always fails. I suspect this is due to the fact that my node is monitored via SNMP and not via the agent. How can I fix this? Unfortunately, there is no function named something like SNMPReadTable that could be used instead.

    Alternatively, do you know any other way to add more details as in the example above to a table threshold alarm?
    Please note that I CANNOT use anything like

    transport = CreateSNMPTransport($node);
    oid = ".1.3.6.1.2.1.43.18.1.1.8." . $event->parameters[5];
    varbind = SNMPGet(transport, oid);
    varbind->value
    

    in my script because the OID is different for different tables I have; also the value of $event->parameters[5] is not always the same as the final number in the OID.
    I need to have the script read the value from the table.


    Screen Shot 2014-11-03 at 10.26.10.png

    1 Reply Last reply
    0
    • M
      M
      mk
      wrote on last edited by
      #2

      I figured it out. GetDCIValueByName is able to return table objects, so it's quite simple:

      sub main()
      {
      	table = GetDCIValueByName($node, $event->parameters[1]);
      	if (table == null)
      	{
      		return "[GetDCIValueByName(" . $node->name . ", " . $event->parameters[1] . ") failed.]";
      	}
      	colNum = 1;
      	alertMsg = table->get($event->parameters[4], colNum);
      	if (alertMsg == null)
      	{
      		return "[table->get(" . $event->parameters[4] . ", " . colNum . ") failed.]";
      	}
      	return alertMsg;
      }
      
      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