NSClient++ Help (#1) - NSCA and Scripts (#222) - Message List

NSCA and Scripts

Is it possible to run a vb script with nsca? If this is the case, what will the syntax like? (I have the NRPE command working, but like to convert to passive checks)

TIA!

  • Message #632

    Absolutely... if you use it from NRPE you "create a command" that is linked to your script ie.: (pseudo configuration here dont recall the names off the top of my head)

    [external scripts]
    <command>=<script>
    [nrpe handlers]
    <alias>=<command>
    

    where:

    • command = an internal command name inside NSClient++ like check_my_script (it is not used to link the 2).
    • script = the script you want to run.
    • alias = the alias in the nagios configuration (ie. service name).

    so if you have a working nrpe setup you have this:

    [external scripts]
    check_my_script=c:\test.bat
    

    and then you do:

    check_nrpe ... -c check_my_script
    

    to make this run via NSCA you do:

    [nsca handlers]
    my_check=check_my_script
    

    and then you add a service check to the server with a description: my_check.

    Hope this helps...

    MickeM

    • Message #641

      After some more testing... NSC.ini (NRPE working)

      NRPEListener.dll
      [NRPE Handlers]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      

      NSC.ini (NRPE not working)

      NRPEListener.dll
      [External Scripts]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      [NRPE Handlers]
      my_win_updates=win_updates
      

      NSC.ini (NSCA (and NRPE) working)

      NRPEListener.dll
      NSCAAgent.dll
      [External Scripts]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      [NSCA Commands]
      my_win_updates=win_updates
      [NRPE Handlers]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      

      NSC.ini (NSCA not working)

      NSCAAgent.dll
      [External Scripts]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      [NSCA Commands]
      my_win_updates=win_updates
      [NRPE Handlers]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      

      NSC.ini (NSCA not working)

      NSCAAgent.dll
      [External Scripts]
      win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
      [NSCA Commands]
      my_win_updates=win_updates
      [NSCA Handlers]
      my_win_updates=win_updates
      

      It looks like the [External Scripts] and [NSCA Handlers] are ignored. If the NRPEListener.dll is "on" then the NSCA script-command is working.

      Is there something i'm missing?

      • Message #642

        mmmm... there is two section that does the same (one connected to NRPEListener) so you are probably right. BUT :) The [External Scripts] section should IIRC not be parsed at all by the NRPEListener it has an (old) [NRPE Handlers] section)

        But regardless you need to load the CheckExternalScripts module instead as it can run your external scripts...

        Michael Medin

        • Message #643

          YES! NSCA is working now ;-) without the NRPEListener.

          NSC.ini

          NSCAAgent.dll
          CheckExternalScripts.dll
          [External Scripts]
          win_updates=cscript.exe //T:30 //NoLogo scripts\\check_windows_updates.wsf /w:0 /c:1
          [NSCA Handlers]
          my_win_updates=win_updates
          
    • Message #635

      Thanks for the quick reply!! It works like a charm!!

Subscriptions