├── apt.conf.d └── 02periodic ├── zabbix_agentd.d └── apt.conf ├── README.md └── templates └── apt-updates.xml /apt.conf.d/02periodic: -------------------------------------------------------------------------------- 1 | APT::Periodic::Enable "1"; 2 | APT::Periodic::Update-Package-Lists "1"; 3 | -------------------------------------------------------------------------------- /zabbix_agentd.d/apt.conf: -------------------------------------------------------------------------------- 1 | # Treat security and regular updates differently 2 | # This is just a simulation, that can be run under zabbix user 3 | # Since updating packages lists (apt-get update) requires root user, 4 | # use APT::Periodic or some other functionality for that 5 | UserParameter=apt.security,apt-get -s upgrade | grep -ci ^inst.*security | tr -d '\n' 6 | UserParameter=apt.updates,apt-get -s upgrade | grep -iPc '^Inst((?!security).)*$' | tr -d '\n' 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Zabbix template for monitoring APT package updates. 2 | 3 | This template uses `-s` simulation option when invoking `apt-get`, so no root access is needed for Zabbix user during polling. 4 | 5 | # Notes 6 | However, root access is required for updating APT repositories. Since Zabbix runs under a dedicated user, it can be done either by using `sudo` in agent configuration script below, using a dedicated `crontab` entry to invoke `apt-get update` periodically or use `APT::Periodic` functionality bundled inside the APT system itself. Support for the `APT::Periodic` is included in this setup. 7 | 8 | Since `APT::Periodic` is executed via already existing APT maintenace script located in `cron.daily`, the minimum period of updating repositories is once a day. If shorter period is required, a spearate `cron.hourly` script is needed instead. 9 | 10 | 11 | # Installation 12 | 1. Copy `apt.conf.d/02periodic` script to `/etc/apt/apt.conf.d` directory to configure daily automatic package repository updates using `APT::Periodic`. 13 | 2. Copy `zabbix_agentd.d/apt.conf` to the Zabbix agent's configuration directory (usually located in `/etc/zabbix`). 14 | 3. Import `templates/apt-updates.xml` to Zabbix frontend. -------------------------------------------------------------------------------- /templates/apt-updates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3.2 4 | 2017-01-29T14:52:23Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 119 | 120 | 121 | 122 | {Template App APT Updates:apt.security.last()}>0 and {Template App APT Updates:apt.updates.last()}>0 123 | 0 124 | 125 | {ITEM.LASTVALUE1} security and {ITEM.LASTVALUE2} regular updates on {HOST.NAME} 126 | 0 127 | 128 | 129 | 0 130 | 2 131 | 132 | 0 133 | 1 134 | 135 | 136 | 137 | 138 | {Template App APT Updates:apt.updates.last()}>0 and {Template App APT Updates:apt.security.last()}=0 139 | 0 140 | 141 | {ITEM.LASTVALUE} regular updates on {HOST.NAME} 142 | 0 143 | 144 | 145 | 0 146 | 1 147 | 148 | 0 149 | 1 150 | 151 | 152 | 153 | 154 | {Template App APT Updates:apt.security.last()}>0 and {Template App APT Updates:apt.updates.last()}=0 155 | 0 156 | 157 | {ITEM.LASTVALUE} security updates on {HOST.NAME} 158 | 0 159 | 160 | 161 | 0 162 | 2 163 | 164 | 0 165 | 1 166 | 167 | 168 | 169 | 170 | 171 | --------------------------------------------------------------------------------