Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented check for available updates for held packages #41

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ a [checkmk server](https://checkmk.com/) reachable from the machine running ansi

In the role we have included some (partialy debian specific) check plugins (`check_mk_local_plugins`):
* `check_apt-update-success` : check if the last apt update process was successful and not too long ago
* `check_apt_updates_for_packages_on_hold` : check if there are updates available for packages set on hold
* `check_reboot` : check if a reboot is required after a apt update
* `check_keepalived` : check the status of keepalive (global an per vrrp instance)
* `check_samba_repl`: check samba DC replication status
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ check_mk_plugins_remove: {}
# check_mk_local_plugins:
# all:
# - check_apt-update-success
# - check_apt_updates_for_packages_on_hold
# - check_reboot
# - check_keepalived
# - check_samba_repl
Expand Down
23 changes: 23 additions & 0 deletions files/check_apt_updates_for_packages_on_hold
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

STATUS="OK"
declare -i RET=0

M=$(apt-mark showhold)
M=${M//$'\n'/ }

if [ -z "$M" ]; then
MSG="no packages on hold found"
else
O=$(apt list -q --upgradable $M 2>/dev/null | sed '1d')
O=${O//$'\n'/; }
if [ -n "$O" ]; then
STATUS="WARNING"
RET=1
MSG="$O"
else
MSG="$M"
fi
fi

echo "$RET UPDATES_FOR_HELD_PACKAGES - $STATUS - $MSG"
Loading