Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - mk

#1
I have a table data collection item configured which pulls the alert messages from our printers. It consists of two columns: SNMP parameter .1.3.6.1.2.1.43.18.1.1.7 is the integer alert code (and I've set that as instance column), and .1.3.6.1.2.1.43.18.1.1.8 is the textual description of the alert.
I have a threshold set on that table which raises the SYS_TABLE_THRESHOLD_ACTIVATED event when the description is neither "Sleep" nor "Sleep mode on". The alarm gets raised properly when the printer has an alert message, but the SYS_TABLE_THRESHOLD_DEACTIVATED event is never raised. The reason for this is that the alert just gets removed from the table because it is no longer reported via SNMP and this does not trigger any events.

Is there any way to raise an SYS_TABLE_THRESHOLD_DEACTIVATED event when the line that triggered the SYS_TABLE_THRESHOLD_ACTIVATED event is removed from a table DCI?

One thing I've thought about is writing a transformation script that does something like this:

idxCode = $1->getColumnIndex("Code");
nodeId = d2x($node->id, 8);
tableId = d2x(FindDCIByName($node, "printerAlert"), 8);
prefix = "DCTTHR_" . nodeId . "_" . tableId . "_"; // the keys look like DCTTHR_<node ID in hex>_<DCI ID in hex>_<instance ID>

alarms = GetAlarmWithKeyStartingWith(prefix);
foreach(alarm : alarms)
{
    removeAlarm = true;
    for (i = 0; i < $1->rowCount; i++)
    {
        if ($1->get(i, idxCode) == substr(alarm->key, length(prefix)) // instance part of the alarm key matches the code in the current row
        {
            removeAlarm = false;
        }
    }
    if (removeAlarm)
    {
        alarm->terminate();
    }
}

Of course, this doesn't work for the simple reason that NXSL does not offer any way to access the  alarm list (i.e. the list which is shown in the Alarm Browser in the GUI), at least I couldn't find one.
There would need to be some way to get an alarm object associated with a specific node and DCI (e.g. GetAlarmWithKeyStartingWith as used above), and the NXSL alarm class would need to have at least a key attribute and a terminate() method.
#2
Right now I get alarm messages like
Quote
Threshold activated on table "prtAlert" row 1 (12)
but I'd prefer to get messages like
Quote
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.
#3
General Support / All requests time out, 100% CPU usage
November 02, 2014, 07:01:14 PM
I just set up NetXMS 1.2.17 on Debian 7 with MySQL and added some hosts and configured some SNMP DCIs. While I was editing a transformation script on a DCI table in a template, the client stopped responding and everything I did would only trigger a "Request Timeout" message. I ended up restarting netxmsd, but that didn't help: whenever I started the client again, I got the same "Request Timeout" messages on everything and the netxmsd process was running at 100% CPU. I somehow managed to close the open tabs in the client and even deleted the device that was associated with the template I was editing. While this did solve the "Request Timeout" issues, I still see 100% CPU usage.
The device eventually came back and became associated to the same template again, and at that time the "Request Timeout" issues came back.

When running netxmsd in debug mode, I saw that it threw several SYS_THREAD_HANG events related to the "Item Poller" and the "Syncer Thread". How do I go about resolving this issue? I'd like to get the CPU usage back down to normal numbers, and I'd of course like to figure out what caused the issue originally.