Todays dumb question *** solved ***

Started by paul, May 26, 2019, 10:10:21 AM

Previous topic - Next topic

paul

What am I doing wrong here? - the OR is not working in Automatic Bind Rules.
left($node->name,4) == "rawd" || left($node->name,4) == "rawq";

These on their own work. left($node->name,4) == "rawd"; and left($node->name,4) == "rawq";   but not when I add the OR (or what I thing is the OR).

my understanding is based on this:
https://www.netxms.org/documentation/adminguide/data-collection.html#instance

Can anyone point me in the direction of where any of this is in any doco?

Tursiops

I am assuming this line is only part of your full script? Otherwise, the or statement doesn't really do anything.
If you want to bind a node to a container based on name starting with rawd or rawq, you will have to add a "return" in front of your line, so that the result of your OR statement is actually used.
Alternatively you can also use
return $node->name ~= "^raw[dq]";

paul

#2
I told you it was a dumb question!!

It is confusing because auto bind asks for a script - but it accepts code as well - which is just one part of what is confusing.

From a solution perspective - fantastic - it works perfectly!! I use it not in a script - just using it "as is"

As much as I think netxms is fantastic, some basic tutorials that demonstrate the syntax and basic script functionality would be a great benefit to those new to netxms.

Another example of something that I should be able to do better. My Windows container uses the following auto bind but I would rather just search for Windows in sysDescription - but I do not know the name of that variable at a netxms level and I do not know the syntax for "contains". I tried like, but that did not work.

So todays dumb question

What is wrong with return $node->sysDescription  like "Windows";

The server has these two attributes in Object view:
System Description=Hardware: Intel64 Family 6 Model 79 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 6.2 (Build 9200 Multiprocessor Free)
SNMP Object ID=.1.3.6.1.4.1.311.1.1.3.1.2

For my Windows container:
works
return $node->snmpOID == ".1.3.6.1.4.1.311.1.1.3.1.2";

does not work
return $node->sysDescription  like "Windows";

paul

Todays answer - add the wild card!!.

return $node-> sysDescription like "*Windows*";

Thanks Victor:
https://www.netxms.org/forum/configuration/snmp-traps-handling/msg4957/#msg4957

Tursiops

The following pages might be useful for scripting:
For the node object, there's documentation on attributes here: https://wiki.netxms.org/wiki/NXSL:Node (for class reference, see https://wiki.netxms.org/wiki/Category:NXSL_Class_Reference)
Comparison operators are documented here: https://wiki.netxms.org/wiki/UM:NetXMS_Scripting_Language_(NXSL)#Comparison_Operators
Function Reference (not sure how up to date that is in regards to new functions): https://wiki.netxms.org/wiki/NXSL_Function_Reference

paul

I had a look at those links however many of the items do not have an example - especially the ones I want.

My latest dumb question - how do I match on rawd or RAWD ?

imatch instead of of ~=

paul