ConSol-Monitoring / snclient

SNClient+ - Cross platform monitoring agent
MIT License
48 stars 8 forks source link

Argument in external script is empty #13

Closed lausser closed 1 year ago

lausser commented 1 year ago
...
CheckExternalScripts = enabled
...
allow arguments = true
...
[/settings/external scripts/scripts]
;restart_service = net start %ARGS%  <- doesn't work, %ARGS% is empty. It only shows the list of running srvices
restart_service = net start Server  <- this works, service is restarted
...

/omd/sites/snclient/lib/monitoring-plugins/check_nsc_web -u https://10.19.2.192:18444 -p HideIT123 -k -t 30 restart_service Server does not succeed. With %ARG% the debug output of snclient shows the output of a "net start" command.

image

lausser commented 1 year ago
[2023-05-31 21:42:54.496][Trace][pid:19624][snclient:644] command: restart_service
[2023-05-31 21:42:54.496][Trace][pid:19624][snclient:645] args: []string{"Server"}
[2023-05-31 21:42:56.848][Trace][pid:19624][listener:378] http response:
HTTP/1.1 200 OK
Connection: close
Content-Type: application/json

{"payload":[{"command":"restart_service","lines":[{"message":"Server wird gestartet.\r\nServer wurde erfolgreich gestartet.\r\n\r\n"}],"result":"OK"}]}

Command is now run with argument, the eventhandler restarts the failed service.