Monitor WordPress Updates with Zabbix



Just another quick Zabbix related post: Since WordPress is known to be a remote shell with the extra feature of being a web blog ((http://www.bash.org/?949214)), it is a good idea, to at least keep your WordPress installations up-to-date. In the currently ongoing effort to replace myself with a more or less clever collection of servers, VMs and shell scripts, I decided to use Zabbix to track the most recent WordPress version and get notifications, when it changes. The following Python scripts searchers for a space followed by three dot-separated numbers on the WordPress download page, which obviously and undoubtedly always corresponds to the current WordPress version number:
#!/usr/bin/env python
import re
import urllib2
response = urllib2.urlopen('https://wordpress.org/download/')
r = re.search(' \d+\.\d+\.\d+', response.read())
if r: print r.group().strip()
Copy that script to the folder holding scripts for so called External checks (/usr/lib/zabbix/externalscripts/wordpress-version.py in my case). After that, create a new template, called "Template Software Version" for example, with a new item of type "External checks" and the name of the above python script as key (only the filename wordpress-version.py, not the whole path). Finally, create a new trigger in that template with the following expression:
{Template Software Versions:wordpress-version.py.diff()}=1
Choose an appropriate serverity level, create a pseudo host and assign this Template to it and enjoy some peace of mind in the approaching Christmas time.

Leave a Reply

Your email address will not be published. Required fields are marked *