Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/x70b1/telegraf-apt
A Telegraf plugin to check Debian for package updates.
https://github.com/x70b1/telegraf-apt
apt debian influxdb monitoring packages telegraf
Last synced: 23 days ago
JSON representation
A Telegraf plugin to check Debian for package updates.
- Host: GitHub
- URL: https://github.com/x70b1/telegraf-apt
- Owner: x70b1
- License: unlicense
- Created: 2022-01-21T00:15:03.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-25T15:12:54.000Z (about 1 year ago)
- Last Synced: 2023-10-26T16:42:29.425Z (about 1 year ago)
- Topics: apt, debian, influxdb, monitoring, packages, telegraf
- Language: Shell
- Homepage:
- Size: 29.3 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telegraf-apt
[![Actions](https://github.com/x70b1/telegraf-apt/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/x70b1/telegraf-apt/actions)
[![Contributors](https://img.shields.io/github/contributors/x70b1/telegraf-apt.svg)](https://github.com/x70b1/telegraf-apt/graphs/contributors)
[![License](https://img.shields.io/github/license/x70b1/telegraf-apt.svg)](https://github.com/x70b1/telegraf-apt/blob/master/LICENSE)A [Telegraf](https://github.com/influxdata/telegraf) plugin to check Debian for package updates.
This plugin runs continuously and prints an output in the interval requested by Telegraf.
In addition, the output can be triggered externally, e.g. during `apt update` to get the latest status in almost real time.
The Debian wiki is queried to check the [LTS status](https://wiki.debian.org/LTS).
You can make use of [needrestart](https://github.com/liske/needrestart) to check the system for outdated libraries.## Configuration
Install `curl`. Also `needrestart` if you like to use it.
To make this plugin useful you need a way to keep your package sources up to date.
You can use `unattended-upgrades` to run `apt update` on a regular basis.To trigger the plugin to collect new stats after an `apt update`, create a `Post-Invoke` configuration.
You can copy [99telegraf](99telegraf) to `/etc/apt/apt.conf.d/99telegraf` or use it as example.Telegraf can be configured like this:
```ini
[[inputs.execd]]
command = ["/bin/sh", "/opt/telegraf/telegraf-apt.sh"]
data_format = "influx"interval = "24h"
signal = "SIGUSR1"
```If Telegraf is able to run `needrestart` with sudo privileges, the corresponding metrics will be collected:
```
telegraf ALL = NOPASSWD: /usr/sbin/needrestart -b
```## Output
```sh
# sh /opt/telegraf/telegraf-apt.sh
apt debian_release="11.2"
apt debian_codename="Bullseye"
apt debian_support=0
apt updates_regular=0
apt updates_security=1
apt updates_severity=2
apt needrestart_services=6
apt needrestart_severity=1
```## How to read
**debian_release**
Returns the release from `/etc/debian_version`.
**debian_codename**
Returns a codename like `Bullseye`, `Buster` ...
**debian_support**
Returns the current support status of your system.
```
0 = full support with official security fixes
1 = LTS with limitied security support
2 = outdated
```**updates_regular**
Returns the number of outstanding regular updates.
**updates_security**
Returns the number of outstanding security updates.
**updates_packages**
Returns a list of packages with outstanding updates.
**updates_severity**
Returns an integer indicator as summary.
```
0 = full Debian support, no updates1 = full Debian support, one or more regular updates
2 = full Debian support, one or more security updates
3 = full Debian support, one or more regular updates and one or more security updates10 = LTS, no updates
11 = LTS, one or more regular updates
12 = LTS, one or more security updates
13 = LTS, one or more regular updates and one or more security updates20 = outdated, no updates
21 = outdated, one or more regular updates
22 = outdated, one or more security updates
23 = outdated, one or more regular updates and one or more security updates
```**needrestart_services**
Returns the number of services which need to be restarted after library upgrades.
**needrestart_severity**
Returns an integer indicator as summary.
```
0 = latest available kernel is running and no services with outdated libraries
1 = latest available kernel is running and one or more services with outdated libraries
2 = latest available kernel is not running and no services with outdated libraries
3 = latest available kernel is not running and one or more services with outdated libraries
```