I have created a global script that runs on Zabbix Agent with a scope of manual host action to remotely reboot a Windows host at a specific time, 1 AM.

The host's Agent 2 already has the "system.run[*]" parameter.
Whenever a user needs to run this script, they should click on the host name in the problem list and run it.
If I run the script locally, it runs fine.

When I simulate an item (system.run[c:\zabbix\reboot.bat]) and test it, it also runs without issues.

However, when I run the global script from the problem list, it shows a success message, but the reboot command is not actually issued.

Also, there are no messages in the Agent or Server log.
Any thoughts on this?
Thank you.
Code:
@echo off
setlocal
:: SECONDS COUNT UNTIL THE NEXT 1H AM,
:: EITHER IN THE SAME DAY OR THE NEXT ONE.
:: by diasdm
for /f "delims=:. tokens=1,2,3" %%a in ("%time%") do (
set /a "hours=%%a"
set /a "minutes=%%b"
set /a "seconds=%%c"
)
if %hours% LSS 1 ( set /a "hoursLeft=1" ) else ( set /a "hoursLeft=25" )
set /a "secondsUntil1AM=(hoursLeft - hours) * 3600 - minutes * 60 - seconds"
:: RESTART COMMAND IS SENT TO HOST.
shutdown /t %secondsUntil1AM% /r /f /m \\{HOST.CONN} /c "System will reboot at 1AM. Command initiated via Zabbix ({USER.FULLNAME})."
echo TIME LEFT TO REBOOT: %secondsUntil1AM%s
The host's Agent 2 already has the "system.run[*]" parameter.
Whenever a user needs to run this script, they should click on the host name in the problem list and run it.
If I run the script locally, it runs fine.
Code:
c:\zabbix> reboot.bat TIME LEFT TO REBOOT: 32176S
When I simulate an item (system.run[c:\zabbix\reboot.bat]) and test it, it also runs without issues.
However, when I run the global script from the problem list, it shows a success message, but the reboot command is not actually issued.
Also, there are no messages in the Agent or Server log.
Any thoughts on this?
Thank you.

Comment