I am running Nagios 3.5 on a Centos 7 machine. The setup is used to monitor some Windows machines via NRPE (check_nrpe commands). For the time being I am using the preconfigured 'alias' commands that come in the 'nsclient-full.ini' file. Everything is working fine so far.
I want to monitor the state of the Windows Updates on my hosts, using the 'alias_updates' command.
; alias_updates - Alias for alias_updates.
alias_updates = check_updates -warning 0 -critical 0 ShowAll=long
Here is the section where all external scripts are defined:
; A list of scripts available to run from the CheckExternalScripts module.
[/settings/external scripts/scripts]
check_updates=C:\Program Files\NSClient++\scripts\check_updates.vbs
Of course I have checked that 'check_updates.vbs' exists in the path I provided. After all, it came bundled with NSClient++.
I have enabled the execution of external scripts:
; Check External Scripts - A simple wrapper to run external scripts and batch files.
CheckExternalScripts = 1
The other relevant configuration options (in my opinion) are:
; Section for NRPE (NRPEServer.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]
; COMMAND ARGUMENT PROCESSING
allow arguments = true
; COMMAND ALLOW NASTY META CHARS
allow nasty characters = false
; PORT NUMBER - Port to use for NRPE.
port = 5666
; Section for external scripts configuration options (CheckExternalScripts).
[/settings/external scripts]
; COMMAND ARGUMENT PROCESSING
allow arguments = true
; COMMAND ALLOW NASTY META CHARS
allow nasty characters = false
; SCRIPT DIRECTORY
script path =
; COMMAND TIMEOUT
timeout = 60
On the Nagios server, from the command prompt, I am trying this:
[root@mama365-account plugins]# ./check_nrpe -H 192.168.10.13 -c alias_updates
The response I am getting is this:
ExternalCommands: failed to create process (C:\Program Files\NSClient++\scripts\check_updates.vbs): it is not an exe file (check NSC.log for more info) - failed to lookup error code: 193( reson: 87)
I understand that NSClient can run plugins that are not executable (*.exe), but merely scripts. And this one is a VB script. Also, the same error message is displayed in the Nagios GUI, in the box corresponding with the command.
Anyone has any idea how to fix this? Reading the docs for NSClient++ has only brought me so far...
UPDATE 1:
I followed the instructions provided by Michael Medin to the letter. Now my 'nsclient-full.ini' looks like this:
; A list of wrappped scripts (ie. using the template mechanism)
[/settings/external scripts/wrapped scripts]
check_updates=scripts\check_updates.vbs
; VISUAL BASIC WRAPPING -
vbs=cscript.exe //T:30 //NoLogo %SCRIPT% %ARGS%
The thing is, now I am getting another error, this time something to do with the execution of the vb script:
C:Program FilesNSClient++scriptscheck_updates.vbs(15, 1) Microsoft VBScript runtime error: Class not defined: 'NagiosPlugin'
On a side note, it looks like the plugin returned 'OK' though, as the corresponding box in Nagios is green.
UPDATE 2:
After searching in the NSClient++ forums I found someone with the same issue. Turns out I was missing a '\':
check_updates=scripts\check_updates.vbs
Should be:
check_updates=scripts\\check_updates.vbs
But I still cannot make it work. It looks like the communication and execution of the script is OK now, but the operation times out. If I override the timeout to 120s with the '-t' option from the command line, I get this error message:
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.