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. White space or formatting rules for filter scripts or other scripts

White space or formatting rules for filter scripts or other scripts

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 52.6k 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.
  • K
    K
    Kevo
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • K
        K
        Kevo
        wrote on last edited by
        #3

        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

        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