White space or formatting rules for filter scripts or other scripts

Started by Kevo, November 01, 2017, 01:34:10 PM

Previous topic - Next topic

Kevo

I spent about 2-3 hours yesterday trying to work out an instance discovery filter script for a template I am working on. I copied and pasted a portion of a script from the Hook::ConfigurationPoll script I got from another forum post to remove dynamic interfaces from Mikrotik routers.

This script worked the first time I added it into the ConfigurigationPoll script, but in the instance discovery filter it wouldn't work. I tried various combinations of the same things, but it never worked. After looking through all the docs I could find on syntax and such, I changed the formatting so things would be more pretty. I only used one space character and a single line feed and nothing else. After "pretty printing" my script it started working.

Are there any special rules or restrictions for scripts on formatting, white space, capitalization, etc. that I should keep in mind when writing scripts?

Also, is there a way to debug a filter script or get NetXMS to show parsing errors or compilation errors of any sort?

Victor Kirhenshtein

Hi,

scripts are case-sensitive - i.e. node and Node are two different identifiers. There are no restrictions on formatting, white spaces, new lines, etc.

You can test your scripts by selecting "execute server script" option on a node. Script will have $node variable set, and you can use trace function or print statement to generate debug output that will be seen in output field during script execution.

Best regards,
Victor

Kevo

It might have been my capitalization of true and false. In the admin guide on p123 under Instance Filter it shows them as TRUE and FALSE. I think I tried camel case as well as all lower case, but there might have been other capitalization issues as well during my attempts that kept it from working. Right now I have all lower case and that seems to be working.

Thanks