Director version (System - About):1.10.2
Icinga Web 2 version and modules (System - About):2.11.4
Icinga 2 version (icinga2 --version):r2.13.7-1
Operating System and version:Debian 11 Kernel 5.10.0-21-amd64
Webserver, PHP versions:Apache 2.4.54 PHP 8.2.3
Hi, can anyone show me working EventCommand config to run powershell script in windows?
here https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#use-event-commands-to-restart-service-daemon-via-command-endpoint-on-windows
is example in icinga doc, but it doesn’t work for me.
here https://community.icinga.com/t/event-commands-windows-services-director/1309/7
is some tips, but not work for me too.
In first example I can’t implement argument PluginDir into command line
command = [
"C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe",
PluginDir + "/restart_service.ps1"
]
in tipbox of command there is rule, when there is relative path, “PluginDir +” will be prefixed, but it’s not true.
seccond example create argument with hardwiring path not work at all for me
arguments = {
“-command” = {
value = “& ‘C:\Program Files\ICINGA2\sbin\restart_service.ps1’”
order = -1
}
My powershell script with given args work as expected in PS in windows.
here is my rendered eventcommand:
script is placed in non spaced path
EventCommand fired on icinga master as can be seen here in log
but nothing happen on windows agent machine, here is debuglog:
Maybe I miss something, but I can’t move on for hours.
Thank for any advice