bundles/zfs: import bundle from work repository
This commit is contained in:
parent
b690ae25b0
commit
4934eb46fb
11 changed files with 841 additions and 0 deletions
33
bundles/zfs/files/check_zfs_auto_snapshot
Normal file
33
bundles/zfs/files/check_zfs_auto_snapshot
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
monitoring=/var/tmp/zfs-auto-snapshot.status
|
||||
crit_days=1
|
||||
|
||||
uptime=$(cut -d. -f1 /proc/uptime)
|
||||
if [ "$uptime" -lt 3600 ]
|
||||
then
|
||||
echo 'OK - The system has just booted'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
now=$(date +%s)
|
||||
timestamp=$(cat "$monitoring")
|
||||
|
||||
if [ -z "$timestamp" ]
|
||||
then
|
||||
echo 'UNKNOWN - No status info found'
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "$timestamp" = 0 ]
|
||||
then
|
||||
echo 'OK - Snapshots disabled'
|
||||
exit 0
|
||||
elif [ $(( now - timestamp )) -gt $(( 60 * 60 * 24 * crit_days )) ]
|
||||
then
|
||||
echo "CRITICAL - Status file indicates age greater than $crit_days day(s)"
|
||||
exit 2
|
||||
else
|
||||
echo 'OK'
|
||||
exit 0
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue