zabbix all-shutdown

Shutdown all hosts connected to a ups with low charge

Create a host related to the UPS

Create a trigger related to the ups_charge with the name “ups_charge”

Example problem expression

{Zabbix server:ups_charge.max(5m)}<60 and {Zabbix server:ups_charge.max(5m)}>0

Configuration -> Actions

Create a Action

Name: ups_charge_action

Add a new condition

Trigger name contains “ups_charge” (name of the trigger)

In Operations

Add a new operational detail

Target List: (Linux Servers or other target)
Operational Type: Remote command
type: custom script
Execute on: Zabbix Agent
commands: sudo /sbin/shutdown -h now

Other commands , for windows shutdown

c:\windows\system32\shutdown.exe /s /f

Conditions
Event Acknowledge equal not ack

Recovery Operations

Operation type: Remote Command
Target List: (Linux Servers or other target)
Type: Custom script
Execute on: zabbix agent
Commands: sudo /sbin/shutdown -c

Press “Add”

On the hosts Agents

execute visudo and add

zabbix ALL=(ALL:ALL) NOPASSWD:/sbin/shutdown

edit /etc/zabbix/zabbix_agentd.conf and enable
EnableRemoteCommand=1

Make sure the agent is enabled on boot
systemctl enable zabbix-agent

Restart the agent
sudo /etc/init.d/zabbix-agent restart