Page 1 of 1

Strange line in my INI config file

PostPosted: Mon Feb 17, 2020 6:35 am
by Ponashish
Hi all,
These days I set up a Nagios server and I still monitoring some servers.
In each ini file, I founded this line and I'm pretty sure that nobody have added that lines:

; Script wrappings - A list of templates for defining script commands. Enter any command line here and they will be expanded by scripts placed under the wrapped scripts section. %SCRIPT% will be replaced by the actual script an %ARGS% will be replaced by any given arguments.
[/settings/external scripts/wrappings]

; Batch file - Command used for executing wrapped batch files
bat = scripts\\%SCRIPT% %ARGS%

; POWERSHELL WRAPPING - Command line used for executing wrapped ps1 (powershell) scripts
ps1 = cmd /c echo If (-Not (Test-Path "scripts\%SCRIPT%") ) { Write-Host "UNKNOWN: Script `"%SCRIPT%`" not found."; exit(3) }; scripts\%SCRIPT% $ARGS$; exit($lastexitcode) | powershell.exe /noprofile -command -

; Visual basic script - Command line used for wrapped vbs scripts
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%

What has happened?
Thanks

Re: Strange line in my INI config file

PostPosted: Mon Feb 17, 2020 8:18 am
by mcapra
Here's the official NSClient++ documentation on wrapped scripts:
https://docs.nsclient.org/howto/externa ... ed-scripts

The ps1 wrapper is the only "complex" one; It's checking to see if the script exists, printing an error if the script doesn't exist, else running the script and preserving the exit code.

I can't say how they got there, but these lines of config are pretty benign if you're not using external scripts.

Re: Strange line in my INI config file

PostPosted: Mon Feb 17, 2020 10:47 am
by scottwilkerson
I agree with mcapra

In addition, it looks like this code is part of the NSClient++ package, so they may be defaults (NSClient++ is NOT Nagios Enterprises software)
https://github.com/mickem/nscp/blob/master/modules/CheckExternalScripts/CheckExternalScripts.cpp#L118