summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/node/files/apt
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-10-20 23:09:14 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-10-20 23:09:14 +0200
commitcde5169221233788f32d6909688b5861349c952d (patch)
treeec4513cb507e48e4228b115c7c8b4c9b8ae2129e /roles/monitoring/prometheus/exporter/node/files/apt
parentcosmetic fixes (diff)
move prometheus node-exporter text collector scripts to templates
Diffstat (limited to 'roles/monitoring/prometheus/exporter/node/files/apt')
-rwxr-xr-xroles/monitoring/prometheus/exporter/node/files/apt40
1 files changed, 0 insertions, 40 deletions
diff --git a/roles/monitoring/prometheus/exporter/node/files/apt b/roles/monitoring/prometheus/exporter/node/files/apt
deleted file mode 100755
index 015addb0..00000000
--- a/roles/monitoring/prometheus/exporter/node/files/apt
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-#
-# Description: Expose metrics from apt updates.
-#
-# Author: Ben Kochie <superq@gmail.com>
-
-upgrades="$(/usr/bin/apt-get --just-print dist-upgrade \
- | /usr/bin/awk -F'[()]' \
- '/^Inst/ { sub("^[^ ]+ ", "", $2); gsub(" ","",$2);
- sub("\\[", " ", $2); sub("\\]", "", $2); print $2 }' \
- | /usr/bin/sort \
- | /usr/bin/uniq -c \
- | awk '{ gsub(/\\\\/, "\\\\", $2); gsub(/"/, "\\\"", $2);
- gsub(/\[/, "", $3); gsub(/\]/, "", $3);
- print "apt_upgrades_pending{origin=\"" $2 "\",arch=\"" $NF "\"} " $1}'
-)"
-
-autoremove="$(/usr/bin/apt-get --just-print autoremove \
- | /usr/bin/awk '/^Remv/{a++}END{printf "apt_autoremove_pending %d", a}'
-)"
-
-echo '# HELP apt_upgrades_pending Apt package pending updates by origin.'
-echo '# TYPE apt_upgrades_pending gauge'
-if [[ -n "${upgrades}" ]] ; then
- echo "${upgrades}"
-else
- echo 'apt_upgrades_pending{origin="",arch=""} 0'
-fi
-
-echo '# HELP apt_autoremove_pending Apt package pending autoremove.'
-echo '# TYPE apt_autoremove_pending gauge'
-echo "${autoremove}"
-
-echo '# HELP node_reboot_required Node reboot is required for software updates.'
-echo '# TYPE node_reboot_required gauge'
-if [[ -f '/run/reboot-required' ]] ; then
- echo 'node_reboot_required 1'
-else
- echo 'node_reboot_required 0'
-fi