NSClient++ Help (#1) - Escaping ":s in commandlines (CheckFiles Filter Problem) (#995) - Message List

Escaping ":s in commandlines (CheckFiles Filter Problem)

HI!
i have a problem with the filter syntax. if i create a alias like:

[/settings/external scripts/alias]
check_wiki = CheckFiles path=O:\XX\YY pattern=index.html max-dir-depth=2 warn=<0 crit=<0 filter=creation<-25h

everithing works greate. but wenn i try to add a 2. filter statement like:

[/settings/external scripts/alias]
check_wiki2 = CheckFiles path=O:\XX\YY pattern=index.html max-dir-depth=2 warn=<0 crit=<0 "filter=creation<-25h AND size>10k"

i get this error:

>>>check_wiki2
d rvice\NSClient++.cpp:923  Injecting: check_wiki2...
l kExternalScripts.cpp:229  Arguments: path=O:\wiki\itdok pattern=index.html max
-dir-depth=2 warn=<0 crit=<0 "filter=creation<-25h AND size>10k"
d rvice\NSClient++.cpp:923  Injecting: checkfiles...
d rvice\NSClient++.cpp:947  Result checkfiles: WARNING
d rvice\NSClient++.cpp:947  Result check_wiki2: WARNING
l ce\simple_client.hpp:80   WARNING:Unknown argument: "filter

thanks for your help!
Martin

  • Message #2641

    The problem is parsing...

    There are two parsers for command lines:

    1. The new "modern" escaped one.
    2. The old split string one.

    The benefit of the new one is it can parse the following:

    foo=bar "bar \" bar "
    

    Where the old one could not.

    The "problem" here though is that paths contain \ meaning your expression will fail. What happens when it fails is that it will use the fall-back old parsing system which doesn't support ":s.

    So the solution is to switch to the new format meaning you have to replace \ with
    to escape them.

    I have in the next build though improved the old syntax to support some basic forms of "...

    So upgrading should also solve your problem (but the better solution is to start escaping your \:s...

    Michael Medin

Subscriptions