Skip to content
Snippets Groups Projects
Commit a4857818 authored by root's avatar root
Browse files

Add Perf data

parent f2c712f4
Branches
No related tags found
No related merge requests found
......@@ -4,18 +4,23 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
OUTPUT=""
PERF_DATA=""
RETURN_CODE="0"
for file in `ls /mnt/vdb/backup/cloud/*.latest`
do
INIT_LINE=$(grep -A 2 "Container:" $file | grep -v ACL | grep -v Sync | grep -v X- | grep -v Accept-Ranges | tr -d '\t ' | tr '\n' ' ')
CONTAINER=$(grep "Container:" $file | cut -d ":" -f 2 | tr -d " ")
BYTES=$(grep "Bytes:" $file | cut -d ":" -f 2 | tr -d " ")
OBJECTS=$(grep "Objects:" $file | cut -d ":" -f 2 | tr -d " ")
LAST_FILE=$(tail -2 $file | grep gpg)
if [ `date -d "${LAST_FILE:5:19}" +%s` -gt `date -d '7 days ago' +%s` ]
then
OUTPUT+="OK : $INIT_LINE Last-Modified:${LAST_FILE:5:19}\n"
OUTPUT+="OK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Modified: ${LAST_FILE:5:19}\n"
else
OUTPUT+="NOK : $INIT_LINE Last-Modified:${LAST_FILE:5:19}\n"
OUTPUT+="NOK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Modified: ${LAST_FILE:5:19}\n"
RETURN_CODE="2"
fi
PERF_DATA+="${CONTAINER}_size=$BYTES ${CONTAINER}_files=$OBJECTS "
done
echo $OUTPUT
echo "$OUTPUT | $PERF_DATA"
exit ${RETURN_CODE}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment