Good evening,
I have noticed these two operators which aren't in the documentation and would like some clarification on their use.
One of them is a single dot. Based on usage, it appears to be used to concatenate strings? From the Wiki page Script Example: Read SNMP Value From Node:
The other one is this which I've seen in a number of places, including the built-in scripts: -> Example from Filter::AgentOrSNMP:
I can see that it's referencing the capabilities of the node, but when I try to do this, the script fails, and NetXMS logs an event with description "error 15 in line 5: uknown object's attribute." On this one, I'm trying to filter out some printers and a few other devices with SNMP that I don't want it to discover. What I was going for on the line causing the error is return true for a device that has SNMP, and also is either running spanning-tree or is a router. Maybe there's a better way to do this. It's my first attempt.
As best I can figure, $1->isSNMP returns true if the discovered node $1 has that capability, but I couldn't find this -> operator in the documentation.
Thanks
I have noticed these two operators which aren't in the documentation and would like some clarification on their use.
One of them is a single dot. Based on usage, it appears to be used to concatenate strings? From the Wiki page Script Example: Read SNMP Value From Node:
Code Select
value = SNMPGetValue(transport, ".1.3.6.1.2.1.1.1.0");
if (value == null)
{
println "Failed to issue SNMP GET request";
return 2;
}
else
{
println "System description: " . value; // This dot
return 0;
}
The other one is this which I've seen in a number of places, including the built-in scripts: -> Example from Filter::AgentOrSNMP:
Code Select
return $1->isAgent || $1->isSNMP;
I can see that it's referencing the capabilities of the node, but when I try to do this, the script fails, and NetXMS logs an event with description "error 15 in line 5: uknown object's attribute." On this one, I'm trying to filter out some printers and a few other devices with SNMP that I don't want it to discover. What I was going for on the line causing the error is return true for a device that has SNMP, and also is either running spanning-tree or is a router. Maybe there's a better way to do this. It's my first attempt.
As best I can figure, $1->isSNMP returns true if the discovered node $1 has that capability, but I couldn't find this -> operator in the documentation.
Code Select
// Select any device running the NetXMS agent,
// or any node with SNMP that matches criteria.
if ($1->isAgent) {exit 1;}
if ($1->isSNMP && ($1->isSTP || $1->isRouter)) {exit 1;}
exit 0;
Thanks