Hello All,
Im new on this forum and i hope ill put my topic in good place
Im using Nagios Core v3 with quite old agent (NSC.ini) and there external scripts are working fine.
In NSC.ini file i have (example):
[Script Wrappings]
vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%
ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
bat=scripts\%SCRIPT% %ARGS%
[External Scripts]
alias_internet_conn_status_ps=cmd /c echo E:\App\Nagios\scripts\check_ic.ps1 $ARG1$; exit($lastexitcode) | powershell.exe -command -
alias_ad_conn_status_ps=cmd /c echo E:\App\Nagios\scripts\check_ad.ps1 $ARG1$; exit($lastexitcode) | powershell.exe -command -
In Nagios Core v4 im using new agent v0.5 and in nsclien.ini i set:
[/settings/NRPE/server]
allow arguments = true
allow nasty characters = true
insecure = true
verify mode = none
[/modules]
CheckExternalScripts = enabled
CheckHelpers = enabled
CheckEventLog = enabled
CheckNSCP = enabled
CheckDisk = enabled
CheckSystem = enabled
CheckTaskSched = enabled
NSClientServer = disabled
NRPEServer = enabled
[/settings/external scripts]
allow arguments = true
;allow nasty characters = true
timeout = 90
vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%
ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
bat=scripts\%SCRIPT% %ARGS%
[/settings/external scripts/alias]
alias_components_status = cmd /c echo E:\App\Nagios\scripts\statut_comp.ps1; exit($lastexitcode) | powershell.exe -command -
internet_conn_status = cmd /c echo E:\App\NSClient++\scripts\check_ic.ps1 %ARG1%; exit($lastexitcode) | powershell.exe -command -
on server site:
define service {
host_name Hostname
service_description Components status
check_command check_nrpe!alias_components_status
use service-template
}
and im getting Unknown command(s): cmd
when i set alias_components_status = statut_comp.ps1
im getting:
Unknown command(s): statut_comp.ps1
I hope you will help me with this
ps before creating this topic i tried to find solution on my own (Using custom scripts with NSClient++) but even if i set it like this im still getting error
Thanks
Regards
zakg
External scripts
Re: External scripts
Hello,
To make external scripts workong in the agent file (nsc or nsclient) set:
[/settings/external scripts/wrappings]
bat = scripts\\%SCRIPT% %ARGS%
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
vbs = cscript.exe //T:90 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
exe = cmd /c %SCRIPT% %ARGS%
[/settings/external scripts/wrapped scripts]
alias_components_status = cmd /c echo E:\App\NSClient++\\scripts\statut_comp.ps1; exit($lastexitcode) | powershell.exe -command -
internet_conn_status = cmd /c echo E:\App\NSClient++\scripts\check_ic.ps1 %ARG1%; exit($lastexitcode) | powershell.exe -command -
/settings/ is important which i missed
Regards
zakg
To make external scripts workong in the agent file (nsc or nsclient) set:
[/settings/external scripts/wrappings]
bat = scripts\\%SCRIPT% %ARGS%
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
vbs = cscript.exe //T:90 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
exe = cmd /c %SCRIPT% %ARGS%
[/settings/external scripts/wrapped scripts]
alias_components_status = cmd /c echo E:\App\NSClient++\\scripts\statut_comp.ps1; exit($lastexitcode) | powershell.exe -command -
internet_conn_status = cmd /c echo E:\App\NSClient++\scripts\check_ic.ps1 %ARG1%; exit($lastexitcode) | powershell.exe -command -
/settings/ is important which i missed
Regards
zakg
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: External scripts
Hello, @zakg. Looks like you got your script to work? If you still need assistance please post the whole NSC.ini file, and show me the command you're running from the XI server to execute the plugin.
Thanks!
Thanks!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.