Since two weeks I'm facing troubles to make up&running this [1] plugin, now I have no idea how to do that.
I try to explain you:
When run from nagios server, it works fine:
Also when started from mssql via powershell works as desired:
But from scheduled job it doesn't return any output:
This is my services definition:
Code: Select all
define service{
use generic-service
host_name vmbg-mssql01
service_description SQL - Jobs
check_command check_nrpe!check_mssql -c check_mssql -a Jobs INST01
contact_groups ictlog
}
define service{
use generic-service
host_name vmbg-mssql01
service_description SQL - DB status
check_command check_nrpe!check_mssql -c check_mssql -a DBStatus INST01
contact_groups ictlog
}
define service{
use generic-service
host_name vmbg-mssql01
service_description SQL - Connection Time
check_command check_nrpe!check_mssql -c check_mssql -a ConnectionTime INST01
contact_groups ictlog
}
define service{
use generic-service
host_name vmbg-mssql01
service_description SQL - DB Size
check_command check_nrpe!check_mssql -c check_mssql -a TempDBSize INST01
contact_groups ictlog
}
And here my nsclient.ini, modified as described here [2]
Code: Select all
[/settings/external scripts/scripts]
check_mssql = cmd /c echo scripts\\check_mssql.ps1 "$ARG1$" ; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
; Script to check external scripts and/or internal aliases.
CheckExternalScripts.dll
[Script Wrappings]
vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%
bat=scripts\%SCRIPT% %ARGS%
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
ps1 = cmd /c echo scripts%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
ps1=cmd /c echo scripts\\\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
[Wrapped Scripts]
check_mssql=check_mssql.ps1 $ARG1$
[/settings/external scripts]
allow arguments = true
;use_file = 1
--------
;[/settings/external scripts/scripts]
;check_mssql=check_mssql.ps1
;[Script Wrappings]
;ps1 = cmd /c echo %SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass C:\scripts\check_mssql.ps1 "$ARG1$"-command -
;check_mssql = cmd /c echo C:\scripts\check_mssql.ps1 "$ARG1$" ; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass ;C:\scripts\check_mssql.ps1 "$ARG1$" -command -
; POWERSHELL WRAPPING -
;ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
;[Wrapped Scripts]
;check_mssql=C:\scripts\check_mssql.ps1 $ARG1$
; POWERSHELL WRAPPING -
;ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
;[/settings/external scripts]
;allow arguments = true
;use_file = 1
Thank in advance guys! if I forget any useful info let me know!
best regard
simob from Italy
[1] https://github.com/yosbit/nagios-plugins/
[2] https://exchange.nagios.org/directory/P ... ct/details