Hi all,
Zabbix v 3.4; the 'Host' is a Windows machine (Server 2012 R2).
I'm new to the Zabbix monitoring and responding world, and I think I have made some good progress so far. I have a Zabbix_server and an Agent on a Host that I'm monitoring. I have configured UserParameters on the Agent and defined some custom keys. These keys simply trigger scripts on the Host/Agent machine. (These are used as hooks to allow the Server to restart processes on the Host when it detects that the processes have stopped working.)
I've run into a small problem - How do you get a Server 'Action' to perform a custom UserParameter on the Host, instead of running a Remote Command? (I suppose that I could just rewrite it as an actual Remote command...RemoteCommands are enabled on the Agent. But I have already got it set up and running via a UserParameter, so I'd like to just reuse that if I can.)
The configuration for the Action->Operation just gives you 'Send Message' or "Remote Command". I have configured a UserParameter on the Host/Agent to run the command that I want it to run:
When I call that key using Zabbix_get from a different remote machine (i.e. not from the Zabbix_server, and not the Host), it successfully performs the command:
So I want my Server Action to do the same thing - just query/call the Host Agent UserParameter/Key, to trigger that same command.
And when this UserParameter is called and the command is run, it is running as a PowerShell script and not as a simple OS batch file. Is there a way to alter that? (I wrote the script as a simple batch file and not a PS script. It's only 3 lines, so would probably be simple to rewrite as PowerShell, but I'm curious about how these things are called and executed.)
Any pointers would be appreciated.
-- J
Zabbix v 3.4; the 'Host' is a Windows machine (Server 2012 R2).
I'm new to the Zabbix monitoring and responding world, and I think I have made some good progress so far. I have a Zabbix_server and an Agent on a Host that I'm monitoring. I have configured UserParameters on the Agent and defined some custom keys. These keys simply trigger scripts on the Host/Agent machine. (These are used as hooks to allow the Server to restart processes on the Host when it detects that the processes have stopped working.)
I've run into a small problem - How do you get a Server 'Action' to perform a custom UserParameter on the Host, instead of running a Remote Command? (I suppose that I could just rewrite it as an actual Remote command...RemoteCommands are enabled on the Agent. But I have already got it set up and running via a UserParameter, so I'd like to just reuse that if I can.)
The configuration for the Action->Operation just gives you 'Send Message' or "Remote Command". I have configured a UserParameter on the Host/Agent to run the command that I want it to run:
Code:
UserParameter=custom.restartPE,c:\Zabbix\scripts\restart_pe.bat
Code:
./zabbix_get -s host.com -p #### -k custom.restartPE
And when this UserParameter is called and the command is run, it is running as a PowerShell script and not as a simple OS batch file. Is there a way to alter that? (I wrote the script as a simple batch file and not a PS script. It's only 3 lines, so would probably be simple to rewrite as PowerShell, but I'm curious about how these things are called and executed.)
Any pointers would be appreciated.
-- J
Comment