2018-06-07 16:30:31 +02:00
2018-06-07 16:30:31 +02:00
2018-06-07 16:27:08 +02:00
2018-06-07 16:30:31 +02:00
2018-06-07 16:30:31 +02:00
2018-06-07 16:30:31 +02:00

Zabbix whois expiry auto-discovery and check

Requirements

  • Python 3
  • pip3 install py-zabbix python-whois

Known issues

.no domains are broken since python-whois just returns a bunch of nulls.

Description

This Zabbix template and associated scripts will automatically create and monitor items and triggers for domain expiry.

It uses trapper items so the scheduling is handled entirely independently from Zabbix Server and can run from anywhere as long as it is able to send values to Zabbix Server.

If zabbix_sender works for a host then this script should too. The py-zabbix module uses the configuration file for zabbix_agent to figure out where to send the trapper items to and such. That means the ServerActive=-parameter in zabbix_agentd.conf is used to figure out where to send the item.

zabbix_sender manpage: https://www.zabbix.com/documentation/3.4/manpages/zabbix_sender

Installation

Put the scripts on the host you want to perform the whois-checks from. Remember that you need Python 3 and to install the modules mentioned further up the readme.

In the same folder as the scripts, create a folder called whois and create a json-file containing the domains you want to check. There's an example included in this repo. Make sure you name the file the same as the hostname in Zabbix because it is used as an argument by the scripts both to pick which json-file to read domains from and which host the data belongs to when sent to the Zabbix server.

Add the Zabbix template to the host and schedule both the discovery and check scripts to run every day or however often you think is approperiate.

Example with cron:


20 12 * * * zabbix-whois-discovery.py example.host.name
30 12 * * * zabbix-whois-check.py example.host.name

Adding domains to existing host

Just add more domains to the approperiate json-files and either run the scripts manually or wait for the cronjob.

Description
Two scripts I wrote for the monitoring system at work
Readme 25 KiB
Languages
Python 100%