ConSol-Monitoring / snclient

SNClient+ - Cross platform monitoring agent
MIT License
47 stars 9 forks source link

NRPE - aliases not working #101

Closed Gent00157 closed 4 months ago

Gent00157 commented 4 months ago

Hi, I am trying snclient as a replacement for (old) nscp on WIndows server 2012 and have an issue with alias commands.

alias_cpu is defined in snclient.ini ( service restarted, no errors in snclient.log)

snclient.ini


...
[/modules]
NRPEServer = enabled
CheckSystem = enabled
CheckDisk = enabled

[/settings/external scripts] timeout = 60 allow nasty characters = false allow arguments = false script root = ${scripts} script path = ignore perfdata = no

[/settings/external scripts/alias] alias_cpu = check_cpu "warn=load>90" "crit=load>95" ...



Now when I call "alias_cpu" : 
**./check_nrpe -H myserver -c alias_cpu**
result: `UNKNOWN - No such check: alias_cpu`

but not-alias commands works:
**./check_nrpe -H myserver -c check_cpu**
result:  `OK - CPU load is ok. 0% on 8 cores |'total 5m'=1%;80;90 'total 1m'=1%;80;90 'total 5s'=0%;80;90`

version check works as well:
**./check_nrpe -H myserver**
result: `SNClient+ v0.20 (Build: 76032af, go1.22.1) |'version'=0.2`

Any idea what I am doing wrong or where the issue might be?
Thank you
sni commented 4 months ago

you probably need to enable external scripts in the module section. Aliases are set there.

Gent00157 commented 4 months ago

Ahh, that's it! It works with CheckExternalScripts = enabled, thank you for response and for snclient as well.

Gent00157 commented 4 months ago

We have to enable CheckExternalScripts = enabled to start aliases to work.

sni commented 4 months ago

i probably gonna change that in the future to make alias work without enabling external scripts because that does not make sense to enable external scripts just for the aliases.

Gent00157 commented 4 months ago

That would be nice, or at least get warning in the log file if CheckExternalScripts is not enabled and aliases are used in config?

sni commented 4 months ago

next release would not have that external script requirement anymore: 411cb92a688b1a34c8e338d25865a59cef789f47