commit 3053907d1b1faff16a28fc349978712796a71141 Author: Gergely Polonkai Date: Wed Apr 27 19:55:53 2016 +0200 Initial version diff --git a/apt-config b/apt-config new file mode 100644 index 0000000..8c5b6ad --- /dev/null +++ b/apt-config @@ -0,0 +1,3 @@ +DPkg { + Post-Invoke{"/usr/bin/zabbix_check_updates";}; +}; diff --git a/cronjob b/cronjob new file mode 100644 index 0000000..a8d63f3 --- /dev/null +++ b/cronjob @@ -0,0 +1 @@ +30 16 * * * root /usr/bin/zabbix_check_updates &> /dev/null diff --git a/zabbix_check_updates b/zabbix_check_updates new file mode 100644 index 0000000..885c689 --- /dev/null +++ b/zabbix_check_updates @@ -0,0 +1,19 @@ +#! /bin/sh + +/usr/bin/apt-get -qq update 2> /dev/null + +security_update_count=`/usr/bin/aptitude \ + -o Dir::Etc::sourcelist="/etc/apt/sources.list.d/security.sources.list" \ + -o "Dir::Etc::sourceparts=/etc/apt/sources.list.d/security.sources.list" \ + search '~U' \ + | wc -l` +update_count=`/usr/bin/aptitude search '~U' | wc -l` + +/usr/bin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf \ + -k 'linupdates[total]' \ + -o "$update_count" +/usr/bin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf \ + -k 'linupdates[security]' \ + -o "$security_update_count" + +exit 0