Skip to content
Snippets Groups Projects
Commit d58b1ebf authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

check_clintstatus: update counter new/ changed/ deleted fileobjects without...

check_clintstatus: update counter new/ changed/ deleted fileobjects without restic snapshot comparison
parent 6747ef4f
Branches
No related tags found
1 merge request!137check_clintstatus: update counter new/ changed/ deleted fileobjects without...
......@@ -18,6 +18,7 @@
# 2022-10-20 ah v1.4 show last backup, prune and verify
# 2023-09-01 ah v1.5 add counters for new/ changed/ deleted fileobjects (Restic only)
# 2023-09-04 ah v1.6 fix perfdata dirs-del=
# 2024-08-28 ah v1.7 update counter new/ changed/ deleted fileobjects without restic snapshot comparison
# ==============================================================================
. $(dirname $0)/includes/jobhelper.sh
......@@ -154,16 +155,31 @@ else
if cat $logfile | grep restic >/dev/null; then
echo ">>> Counters:"
iModFNew=$( cat $logfile | grep -c "^+ /.*[^/]$" )
iModDNew=$( cat $logfile | grep -c "^+ /.*/$" )
iModFChange=$( cat $logfile | grep -c "^M /.*[^/]$" )
iModDChange=$( cat $logfile | grep -c "^M /.*/$" )
iModFDelete=$( cat $logfile | grep -c "^- /.*[^/]$" )
iModDDelete=$( cat $logfile | grep -c "^- /.*/$" )
printf "__COUNTERS__New: %10s files %10s dirs\n" $iModFNew $iModDNew
printf "__COUNTERS__Changed: %10s files %10s dirs\n" $iModFChange $iModDChange
printf "__COUNTERS__Deleted: %10s files %10s dirs\n" $iModFDelete $iModDDelete
# This is faster andd doesn't need comparison of snapshots in output
# and works with initial backups too
iModFNew=$( cat $logfile | grep "^Files:.*unmodified" | awk '{sum+=$2;} END {print sum;}' )
iModFChange=$( cat $logfile | grep "^Files:.*unmodified" | awk '{sum+=$4;} END {print sum;}' )
iModFNone=$( cat $logfile | grep "^Files:.*unmodified" | awk '{sum+=$6;} END {print sum;}' )
iModFDelete=$( cat $logfile | grep "^Files:.*removed" | awk '{sum+=$4;} END {print sum;}' )
iModDNew=$( cat $logfile | grep "^Dirs:.*unmodified" | awk '{sum+=$2;} END {print sum;}' )
iModDChange=$( cat $logfile | grep "^Dirs:.*unmodified" | awk '{sum+=$4;} END {print sum;}' )
iModDNone=$( cat $logfile | grep "^Dirs:.*unmodified" | awk '{sum+=$6;} END {print sum;}' )
iModDDelete=$( cat $logfile | grep "^Dirs:.*removed" | awk '{sum+=$4;} END {print sum;}' )
# old way:
# iModFNew=$( cat $logfile | grep -c "^+ /.*[^/]$" )
# iModDNew=$( cat $logfile | grep -c "^+ /.*/$" )
# iModFChange=$( cat $logfile | grep -c "^M /.*[^/]$" )
# iModDChange=$( cat $logfile | grep -c "^M /.*/$" )
# iModFDelete=$( cat $logfile | grep -c "^- /.*[^/]$" )
# iModDDelete=$( cat $logfile | grep -c "^- /.*/$" )
printf "__COUNTERS__New: %10s files %10s dirs\n" $iModFNew $iModDNew
printf "__COUNTERS__Changed: %10s files %10s dirs\n" $iModFChange $iModDChange
printf "__COUNTERS__Deleted: %10s files %10s dirs\n" $iModFDelete $iModDDelete
printf "__COUNTERS__Unchanged: %10s files %10s dirs\n" $iModFNone $iModDNone
echo "__PERFDATA__ |files-new=$iModFNew;;;0 files-mod=$iModFChange;;;0 files-del=$iModFDelete dirs-new=$iModDNew;;;0 dirs-mod=$iModDChange;;;0 dirs-del=$iModDDelete;;;0"
echo
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment