NSClient++ Help (#1) - Unable to execute LUA script via NRPE (#578) - Message List

Unable to execute LUA script via NRPE

Hi!

I've written a command as a LUA function and I'm trying to query it from remote Nagios box via NRPE, but any attempt failed so far.

Just to check if the problem is anyhow bound to my function, I've made the same tests with standard lua_debug function, ending up wit

The function is available in /test mode:

[...] l NSClient++.cpp(438) Enter command to inject or exit to terminate... lua_debug a1 a2 d NSClient++.cpp(1073) Injecting: lua_debug: a1, a2 d NSClient++.cpp(1109) Injected Result: OK 'hello' d NSClient++.cpp(1110) Injected Performance Result: OK:hello

But if I try to call it from Nagios box I get:

$ ./check_nrpe -H 10.0.0.81 -p 5666 -c lua_debug -a a1 a2 UNKNOWN: No handler for that command $

Other NRPE checks work as expected. 10.0.0.81 is the right IP address.

There's something I'm overlooking? Any clues? Thank you.

  • Message #1759

    I'm sorry for bad formatting. The test output is:

      [...]
      l NSClient++.cpp(438) Enter command to inject or exit to terminate...
      lua_debug a1 a2
      d NSClient++.cpp(1073) Injecting: lua_debug: a1, a2
      d NSClient++.cpp(1109) Injected Result: OK 'hello'
      d NSClient++.cpp(1110) Injected Performance Result: ''
      OK:hello
    

    While the remote check via NRPE is:

      $ ./check_nrpe -H 10.0.0.81 -p 5666 -c lua_debug -a a1 a2
      UNKNOWN: No handler for that command
      $
    

    thank you

    • Message #1760

      Could you check the log from when you run from check_nrpe?

      A good idea is to "stop" the service and use "NSClient++ /test" when you run from check_nrpe as that will give you any errors and such.

      Michael Medin

      • Message #1761

        I have stopped NSClient++ as a service and started it on the terminal with /test option. Now it's answering to lua_debug command as expected:

        $ ./check_nrpe -H 10.0.0.81 -p 5666 -c lua_debug
        hello
        $
        

        and the log reports:

        2010-05-14 14:19:07: debug:NSClient++.cpp:1073: Injecting: lua_debug: ciao, mondo
        2010-05-14 14:19:07: debug:NSClient++.cpp:1109: Injected Result: OK 'hello'
        

        The NSC.ini contains:

        [modules]
        FileLogger.dll
        CheckSystem.dll
        CheckDisk.dll
        NRPEListener.dll
        CheckEventLog.dll
        LUAScript.dll
        NSCAAgent.dll
        [Settings]
        password=************
        allowed_hosts=
        use_file=1
        [log]
        debug=1
        file=NSC.log
        date_mask=%Y-%m-%d %H:%M:%S
        [Check System]
        CPUBufferSize=10m
        CheckResolution=10
        [NRPE]
        port=5666
        command_timeout=60
        allow_arguments=1
        allow_nasty_meta_chars=1
        use_ssl=1
        allowed_hosts=10.9.2.23/32, 92.42.97.4/32
        [LUA Scripts]
        scripts\test.lua
        
        • Message #1762

          But it still does not work when you run as a service? (should not make difference really)

          • Message #1763

            Exactly, as you can see here:

            # ./check_nrpe -H 10.0.0.81 -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=1 MinCritFree=1 Drive=c:
            OK: c:: 52G|'c:'=55884980224B;320070287359;320070287359;
            # ./check_nrpe -H 10.0.0.81 -p 5666 -c lua_debug -a a1 a2
            UNKNOWN: No handler for that command
            #
            

            If restarted from the command line with /test, everything works as expected:

            # ./check_nrpe -H 10.0.0.81 -p 5666 -c CheckDriveSize -a ShowAll MinWarnFree=1 MinCritFree=1 Drive=c:
            OK: c:: 52G|'c:'=55885119488B;320070287359;320070287359;
            # ./check_nrpe -H 10.0.0.81 -p 5666 -c lua_debug -a a1 a2
            hello
            #
            

            Just stopped the service from windows services panel and started it from the command line.

            I'm using NSClient++ Version: 0.3.7.493 2009-10-12, Plattform: w32

            • Message #1838

              This is supposedly fixed in 0.3.8 right?

              Michael Medin

Subscriptions