Commit 4222e7f9 authored by Leonidas Spyropoulos's avatar Leonidas Spyropoulos Committed by Jelle van der Waa
Browse files

prometheus: Add monitoring and alert for orphan and foreign packages

Closes: #332

Signed-off-by: Leonidas Spyropoulos's avatarLeonidas Spyropoulos <artafinde@gmail.com>
parent 634e3d07
......@@ -221,6 +221,24 @@ groups:
annotations:
description: 'host {{ $labels.instance }} has vulnerable date packages'
summary: '{{ $labels.instance }} has {{ $value }} vulnerable packages'
- alert: pacman_orphans
expr: pacman_orphans > 0
for: 15m
labels:
severity: warning
service: pacman
annotations:
description: 'host {{ $labels.instance }} has orphan packages'
summary: '{{ $labels.instance }} has {{ $value }} orphan packages'
- alert: pacman_foreigns
expr: pacman_foreigns > 0
for: 15m
labels:
severity: warning
service: pacman
annotations:
description: 'host {{ $labels.instance }} has foreigns packages'
summary: '{{ $labels.instance }} has {{ $value }} foreigns packages'
- name: btrfs
interval: 2m
......
......@@ -18,6 +18,8 @@ trap "rm -f $TMP_FILE" EXIT
updates=$(/usr/bin/checkupdates | wc -l)
secupdates=$(/usr/bin/arch-audit -u | wc -l)
orphans=$(/usr/bin/pacman -Qdtq | wc -l)
foreigns=$(/usr/bin/pacman -Qmq | wc -l)
echo "# HELP pacman_updates_pending number of pending updates from pacman" >> $TMP_FILE
echo "# TYPE pacman_updates_pending gauge" >> $TMP_FILE
......@@ -27,4 +29,12 @@ echo "# HELP pacman_security_updates_pending number of pending updates from pacm
echo "# TYPE pacman_security_updates_pending gauge" >> $TMP_FILE
echo "pacman_security_updates_pending $secupdates" >> $TMP_FILE
echo "# HELP pacman_orphans number of orphan packages from pacman" >> $TMP_FILE
echo "# TYPE pacman_orphans gauge" >> $TMP_FILE
echo "pacman_orphans $orphans" >> $TMP_FILE
echo "# HELP pacman_foreigns number of foreign packages from pacman" >> $TMP_FILE
echo "# TYPE pacman_foreigns gauge" >> $TMP_FILE
echo "pacman_foreigns $foreigns" >> $TMP_FILE
mv -f $TMP_FILE $PROM_FILE
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment