Dette kan enkelt overvåkes i zabbix
Opprett fil /etc/zabbix/zabbix_agentd.conf.d/apt.conf på klient:
# Find number of updates, ubuntu
UserParameter=apt.security,/usr/lib/update-notifier/apt-check 2>&1 | cut -f2 -d";"
UserParameter=apt.updates,/usr/lib/update-notifier/apt-check 2>&1 | cut -f1 -d";"
UserParameter=ubuntu.reboot-required,test -f /var/run/reboot-required && echo 1 || echo 0
UserParameter=ubuntu.reboot-required-age,test -f /var/run/reboot-required && echo $(( `date +%s` - `stat -c%Y /var/run/reboot-required`)) || echo 0
På zabbix-server
- lag en template, Ubuntu Template
- Lag item Ubuntu reboot required. Type: Zabbix agent, Key: ubuntu.reboot-required, Type of information: Numeric (unsigned), Units: boolean, Update interval: 5m…
- Lag item Ubuntu security updates, som over men Key: apt.security
- Lag item Ubuntu updates, som over men Key: apt.updates
- Lag item Ubuntu reboot required file age, Type: Zabbix agent, Key: ubuntu.reboot-required-age, Type of information: Numeric (unsigned), Units: seconds, Update interval: 5m…
- Lag trigger Available security updates on {HOST.NAME}, Expression: {Ubuntu
Template:system.run[«/usr/lib/update-notifier/apt-check 2>&1 |
cut -f2 -d’;'»].avg(6h)}>=1 and {Ubuntu
Template:system.run[«/usr/lib/update-notifier/apt-check 2>&1 |
cut -f2 -d’;'»].last()}>0
eller
{Ubuntu Template:apt.security.last()}>0 - Lag trigger Available updates on {HOST.NAME} high, Expression: {Ubuntu Template:apt.updates.last()}>35
- Lag trigger Reboot required, Expression: {Ubuntu Template:ubuntu.reboot-required-age.last()}>0
- Lag trigger Reboot required long time ago, Expression: {Ubuntu Template:ubuntu.reboot-required-age.last()}>604800