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

Zabbix Debian Install

Install instructions:
https://www.zabbix.com/documentation/4.0/manual/installation/install_from_packages/debian_ubuntu

# apt install zabbix-server-mysql

# apt install zabbix-frontend-php

# mysql
create database zabbix character set utf8 collate utf8_bin;

grant all on zabbix.* to zabbix identified by ‘awsome password’;

flush privileges;

zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix

# vi /etc/zabbix/zabbix_server.conf

https://www.zabbix.com/documentation/4.0/manual/installation/install#installing_frontend

# openssl rand -hex 512

Increase CacheSize zabbix_server.conf
CacheSize=32M