NSClient++ Help (#1) - NRPE allow arguments [SOLVED] (#536) - Message List

NRPE allow arguments [SOLVED]

I am trying to use NRPE Handler with arguments with 0.3.7.493

Works from command line with NSClient++

check_inject "CheckDriveSize CheckAll"
d NSClient++.cpp(1073) Injecting: check_inject: CheckDriveSize CheckAll
d NSClient++.cpp(1073) Injecting: CheckDriveSize: CheckAll
d \checkHelpers.hpp(758) Missing bounds for maxmin-bounds check: C:\
d \checkHelpers.hpp(758) Missing bounds for maxmin-bounds check: Q:\
d NSClient++.cpp(1109) Injected Result: OK 'OK: All drives within bounds.'
d NSClient++.cpp(1110) Injected Performance Result: ''C:\'=40534319104B;0;0; 'Q:
\'=4951650304B;0;0; '
d NSClient++.cpp(1109) Injected Result: OK 'OK: All drives within bounds.'
d NSClient++.cpp(1110) Injected Performance Result: ''C:\'=40534319104B;0;0; 'Q:
\'=4951650304B;0;0; '
OK:OK: All drives within bounds.|'C:\'=40534319104B;0;0; 'Q:\'=4951650304B;0;0;

Not from call to NRPEListener

d NSClient++.cpp(1073) Injecting: check_inject "CheckDriveSize CheckAll":
l NSClient++.cpp(1124) No handler for command: 'check_inject "CheckDriveSize Che
ckAll"'
l \NSCHelper.cpp(238) No handler for command 'check_inject "CheckDriveSize Check
All"'.

NSC.ini is

[NRPE_Handlers]
check_inject=inject $ARG1$

I can see there is an issue for 0.3.6 but from the changelog thought this had been corrected for 0.3.7.

Am I doing something wrong?

  • Message #1669

    Humm..

    [NRPE_Handlers]
    

    Should I think be:

    [NRPE Handlers]
    

    But all in all I would recommend using the CheckExternalScripts module instead (since this is deprecated)

    // Michael Medin

    • Message #1674

      Thanks for the swift reply. NRPE_Handlers was a typo on my part in the message ( was OK in the file ). I've tried it with External Aliases. Same result.

      NSClient++ -test log extract example command from NSC.ini alias_cpu used first followed by one I defined alias_cpunni ShowAll

      NSC.ini entry is alias_cpunni=CheckCPU $ARG1$

      alias_cpu
      d NSClient++.cpp(1073) Injecting: alias_cpu:
      d NSClient++.cpp(1073) Injecting: checkCPU: warn=80, crit=90, time=5m, time=1m,
      time=30s
      d NSClient++.cpp(1109) Injected Result: OK 'OK CPU Load ok.'
      d NSClient++.cpp(1110) Injected Performance Result: ''5m'=1%;80;90; '1m'=7%;80;9
      0; '30s'=15%;80;90; '
      d NSClient++.cpp(1109) Injected Result: OK 'OK CPU Load ok.'
      d NSClient++.cpp(1110) Injected Performance Result: ''5m'=1%;80;90; '1m'=7%;80;9
      0; '30s'=15%;80;90; '
      OK:OK CPU Load ok.|'5m'=1%;80;90; '1m'=7%;80;90; '30s'=15%;80;90;
      alias_cpunni ShowAll
      d NSClient++.cpp(1073) Injecting: alias_cpunni: ShowAll
      d NSClient++.cpp(1073) Injecting: checkCPU: ShowAll
      d NSClient++.cpp(1109) Injected Result: OK 'OK CPU Load ok.'
      d NSClient++.cpp(1110) Injected Performance Result: ''
      d NSClient++.cpp(1109) Injected Result: OK 'OK CPU Load ok.'
      d NSClient++.cpp(1110) Injected Performance Result: ''
      OK:OK CPU Load ok.
      

      Then submitted to NRPELister via TCP from a local script 1. alias_cpu 2. alias_cpunni ShowAll

      d NSClient++.cpp(1073) Injecting: alias_cpu:
      d NSClient++.cpp(1073) Injecting: checkCPU: warn=80, crit=90, time=5m, time=1m,
      time=30s
      d NSClient++.cpp(1109) Injected Result: OK 'OK CPU Load ok.'
      d NSClient++.cpp(1110) Injected Performance Result: ''5m'=8%;80;90; '1m'=40%;80;
      90; '30s'=50%;80;90; '
      d NSClient++.cpp(1109) Injected Result: OK 'OK CPU Load ok.'
      d NSClient++.cpp(1110) Injected Performance Result: ''5m'=8%;80;90; '1m'=40%;80;
      90; '30s'=50%;80;90; '
      d NSClient++.cpp(1073) Injecting: alias_cpunni ShowAll:
      l NSClient++.cpp(1124) No handler for command: 'alias_cpunni ShowAll'
      l \NSCHelper.cpp(238) No handler for command 'alias_cpunni ShowAll'
      

      I can do other stuff from the command line which works fine, such as alias_cpunni "warn=70 crit=80 1m 5m 15m" and it works great, but whenever I add an argument and call via the socket on 5666 ( I'm using nrpe_packet version 2 ) I get the no handler result.

      • Message #1682

        I've resolved it. I'd ommitted the "!" between the command and the arguments in the nrpe packet.

        This worked.

        alias_cpunni!warn=70 crit=80 1m 5m 15m
        

        Why am I trying to do this? I am required to do passive monitoring, so using NSClient++ passively. Parms can be altered. Using variation of method outlined in Section 20.4.3 of Nagios 2nd Edition System and Network Monitoring by Wolfgang Barth.

        Thanks for your help.

        • Message #1683

          Humm... Using alias definitions I understand (and that works without problems) what I did not understand was:

          check_inject=inject $ARG1$
          

          This effectively attempts tells NSClient++ to "execute this command which is given as an argument" but since NSClient++ will allow you to execute all commands anyways:

          Your example:

          check_nrpe -c check_inject -a CheckCPU
          

          "would" be the same (albeit less efficient) as:

          check_nrpe -c CheckCPU
          

          // Michael Medin

      • Message #1677

        I just noticed that the command is an argument. Not sure why you try to do this?

        But I would guess it is not supported. (but I am not sure I see the use case for it)

        // Michael Medin

Subscriptions