Compare commits
2 Commits
4d63d9f3e9
...
05d6be51b8
Author | SHA1 | Date | |
---|---|---|---|
05d6be51b8 | |||
daa098849c |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) <year> <copyright holders>
|
Copyright (c) 2021 Vintage Salt
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
rr="/var/run/reboot-required"
|
rr="/var/run/reboot-required"
|
||||||
rrpkgs="/var/run/reboot-required.pkgs"
|
rrpkgs="/var/run/reboot-required.pkgs"
|
||||||
# 604800 - 1 week in seconds
|
# 604800 - 1 week in seconds
|
||||||
threshold="${1:-604800}"
|
threshold_crit="${1:-604800}"
|
||||||
|
# 259200 - 3 days in seconds
|
||||||
|
threshold_warn="${2:-259200}"
|
||||||
if [ -f "$rr" ]; then
|
if [ -f "$rr" ]; then
|
||||||
# We have a pending reboot; alert in different states depending on its age
|
# We have a pending reboot; alert in different states depending on its age
|
||||||
lastmod=$(date +%s -r "$rr")
|
lastmod=$(date +%s -r "$rr")
|
||||||
@ -21,12 +23,15 @@ if [ -f "$rr" ]; then
|
|||||||
if [ -z "$pkgs" ]; then
|
if [ -z "$pkgs" ]; then
|
||||||
pkgs="(No output)"
|
pkgs="(No output)"
|
||||||
fi
|
fi
|
||||||
if (( now - lastmod > threshold )); then
|
if (( now - lastmod < threshold_warn )); then
|
||||||
echo "CRITICAL - Pending reboot older than $threshold seconds: $pkgs"
|
echo "OK - Pending reboot: $pkgs"
|
||||||
exit 2
|
exit 0
|
||||||
else
|
elif (( now - lastmod < threshold_crit )); then
|
||||||
echo "WARNING - Pending reboot: $pkgs"
|
echo "WARNING - Pending reboot older than $threshold_warn seconds: $pkgs"
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo "CRITICAL - Pending reboot older than $threshold_crit seconds: $pkgs"
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# We have no pending reboots
|
# We have no pending reboots
|
||||||
|
Loading…
Reference in New Issue
Block a user