Check your outdated python packages with Zabbix
I use Zabbix as an alert/monitoring system for my servers and applications. When it comes to a django application, I work with virtual environments and pip. It is easy to have the list of outdated packages. I wanted to be alerted with zabbix when a new package is outdated.
Create your script
$ cat /etc/zabbix/plugins/pip_outdated #!/bin/bash source path_to_virtualenv PACKAGE_NUMBER="$(pip list --no-cache-dir --outdated | wc -l)" echo $PACKAGE_NUMBER
Create your zabbix custom agent
$ cat /etc/zabbix/zabbix_agentd.d/pip_outdated.conf UserParameter=pipOutdated,/etc/zabbix/plugins/pip_outdated
Increase the timeout
The pip list outdated command may take some time. It can be necessary to increase the timeout in the zabbix agent configuration (/etc/zabbix/zabbix_agentd.conf)
Test your new zabbix agent command
$ sudo zabbix_agentd -t pipOutdated pipOutdated [t|20]
Create a new item on your Zabbix server
Create a new item in "Configuration > Host > Item > Create item"
Create a new trigger on your Zabbix server
Create a new trigger in "Configuration > Host > Triggers > Create trigger"