Sample program for controlling host status on Zabbix.
- Enable or disable host status as runlevel.
- Registerd new host on bootstraping, like as AWS Autoscaling.
- Attach templates that the host needs.
- Set macro that the host needs.
- Add graphs of hosts to the screen.
$ cd /usr/local/src
$ git clone https://github.com/uorat/zabbix-host-controller.git
$ cp /usr/local/src/zabbix-host-controller/example/zabbix-host-controller.init /etc/init.d/zabbix-host-controller
$ chkconfig zabbix-host-controller on
Edit zabbix_config.py for your environment.
class ZabbixConfig:
ZABBIX_API_URL = "http://your-zabbix.local/zabbix/api_jsonrpc.php"
HEADERS = {
"Content-Type": "application/json"
}
USER = "Admin"
PASSWORD = "zabbix"
$ /etc/init.d/zabbix-host-controller start
=> host: your-host01, hostid: 11407, status: 1
=> status update : hostid: 11407, result: True
=> host: your-host01, hostid: 11407, status: 0
zabbix-host-control start: [OK]
$ /etc/init.d/zabbix-host-controller stop
=> host: your-host01, hostid: 11407, status: 0
=> status update : hostid: 11407, result: True
=> host: your-host01, hostid: 11407, status: 1
zabbix-host-control stop: [OK]
- OS
- AmazonLinux 1.x
- AmazonLinux 2.x
- CentOS 6
- CentOS 7
- Zabbix v2.4 ~ v3.2