Giter Club home page Giter Club logo

zabbix-template-apt-upgrade-monitoring's Introduction

Zabbix Template to monitor available package upgrades in hosts

Zabbix template that monitors hosts for available package upgrades in Debian / Ubuntu / "apt" package manager distros.

The script runs apt-get update to update source lists and then runs apt-get upgrade -s in simulation mode (no upgrade is executed). Data is then send to Zabbix server in various formats. A problem will be shown in the dashboard in case there is > 1 packages to update.

Overview

Zabbix Server version: 6.0

Sample output of apt-get upgrade -s from which we extract the info for the template:

The following packages have been kept back:
  zabbix-frontend-php
The following packages will be upgraded:
  zabbix-agent zabbix-apache-conf zabbix-server-mysql zabbix-sql-scripts
4 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Versions

This template was tested on:

  • Zabbix Server 6.0 (LTS)
  • Zabbix Agent (daemon) 5.0.21
  • Debian 11

Setup

On Zabbix frontend server:

  • Download and import either server_template_check_apt_updates_templates.xml, server_template_check_apt_updates_templates.json or server_template_check_apt_updates_templates.yml to Zabbix frontend.

  • Assign the Template Debian APT Updates to the host(s) you want to monitor

On all hosts you want to monitor:

  • Install packages zabbix-agent and zabbix-sender:

    apt-get install zabbix-agent zabbix-sender

  • Copy content or download apt_upgrade_agent_script.sh script and move into host folder (Example): /etc/zabbix/custom_scripts

    wget https://github.com/Moluss/zabbix-template-apt-upgrade-monitoring/tree/main/agent_scripts

  • Grant exec permissions

    sudo chmod +x /etc/zabbix/custom_scripts/apt_upgrade_agent_script

  • Add entry to crontab (sudo crontab -e) to execute the script periodically to check for updates and then check for possible upgrades and send data to Zabbix Server. This cron will run every 12 hours:

    `0 */12 * * * sh /etc/zabbix/custom_scripts/apt_upgrade_agent_script.sh

zabbix-template-apt-upgrade-monitoring's People

Contributors

akulink1 avatar marioaonedocument avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

zabbix-template-apt-upgrade-monitoring's Issues

error syntax

expr: erreur de syntaxe: argument manquant après « + »
zabbix_sender [1244762]: ERROR: [line 1] 'Key value' required
Sending failed. Use option -vv for more detailed output.

Enhacement #1: Track security updates

Some packages are marked as security updates, which would be useful to categorize in its own category and show an alert in the Server Template name.

https://serverfault.com/questions/424486/how-to-get-a-list-of-security-updates-on-the-command-line-in-debian-ubuntu

  • Zabbix Template 1: Add a new item in Zabbix template
  • Zabbix Template 2: Change trigger so that trigger name shows which of the updates are security updates
  • Agent script 3: Grep the field in apt-upgrade -s output (security might not be enough, maybe grep by Debian-Security) and send to Zabbix server

error syntax

expr: erreur de syntaxe: argument manquant après « + »
zabbix_sender [1244762]: ERROR: [line 1] 'Key value' required
Sending failed. Use option -vv for more detailed output.

ERROR: [line 1] 'Key value' required

expr: syntax error
zabbix_sender [717]: DEBUG: In zbx_tls_init_child()
zabbix_sender [717]: DEBUG: OpenSSL library (version OpenSSL 1.0.2g 1 Mar 2016) initialized
zabbix_sender [717]: DEBUG: zbx_tls_init_child() loaded PSK identity "xxxx"
zabbix_sender [717]: DEBUG: zbx_tls_init_child() loaded PSK from file "/etc/zabbix/zabbix_agentd.psk"
zabbix_sender [717]: DEBUG: zbx_tls_init_child() PSK ciphersuites: PSK-AES128-CBC-SHA
zabbix_sender [717]: DEBUG: End of zbx_tls_init_child()
zabbix_sender [717]: ERROR: [line 1] 'Key value' required

All Items Failed

I've got these Errors:

Response from "192.168.178.101:10051": "processed: 0; failed: 6; total: 6; seconds spent: 0.000542"
sent: 6; skipped: 0; total: 6

From zabbix server log file I see this log
990:20220626:115517.361 connection of type "unencrypted" is not allowed for host "xxx-srv-data01"

Can you help in this case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.