Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit ce7fb8df authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

More reporting

parent 8895d081
......@@ -11,8 +11,12 @@ exec 1> >(logger -s -t $(basename $0)) 2>&1
#
###################
zabbix(){
zabbix_sender -k resifdatadump.failed -s $(hostname -a) -o $1 -z monitoring.osug.fr
zabbix_err(){
zabbix_sender -k resifdatadump.failed -s $(hostname -a) -o "${@}" -z monitoring.osug.fr
}
zabbix_ok(){
zabbix_sender -k resifdatadump.ok -s $(hostname -a) -o "${@}" -z monitoring.osug.fr
}
# Format a report line. Parameters is the list of data to append to the report :
......@@ -34,7 +38,8 @@ format_report(){
THROUGHPUT=$5
SHA=$6
COMMENT=${@:7}
printf " %6s | %9s | %9s | %13s | %16s | %6s | %6s | %18s | %s" $Y $N $S $SIZE $DATE $DURATION $THROUGHPUT $SHA "${COMMENT}"
printf " %6s | %9s | %9s | %13s | %16s | %6s | %6s | %18s | %s" $Y $N $S $SIZE $DATE $DURATION $THROUGHPUT $SHA "${COMMENT}"
echo
}
# Push data to irods as a staging file
......@@ -49,7 +54,7 @@ irods_push(){
imkdir -p $KEY
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 002 creating remote directory. Manual action has to be taken."
zabbix "${KEY}:Error 002"
zabbix_err "${KEY}:Error 002"
exit 1
fi
......@@ -64,7 +69,7 @@ irods_push(){
# Roll back
irods_rollback $KEY
# Alert to zabbix
zabbix "${KEY}:Error 011"
zabbix_err "${KEY}:Error 011"
else
echo "[$KEY] staging.tar data sent, let's commit everything on irods server"
format_report $KEY $SIZEMB $(date +%Y-%m-%dT%H%M%S --date=@$start) $duration $throughput 'OK' >> $LOCAL_REPORT
......@@ -72,6 +77,7 @@ irods_push(){
fi
# Send report to irods
iput -f $LOCAL_REPORT $IRODS_REPORT
zabbix_ok "$KEY|${SIZEMB}MB|${duration}s|${throughput}MB/s"
}
# In case of any problem, this function rolls every distant file operation bask
......@@ -112,7 +118,7 @@ irods_commit(){
imv $KEY/previous.tar $KEY/previous_to_delete.tar
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 003 moving previous.tar around. Corrective action has to be taken manualy"
zabbix "${KEY}:Error 003"
zabbix_err "${KEY}:Error 003"
return 1
fi
)
......@@ -122,7 +128,7 @@ irods_commit(){
imv $KEY/latest.tar $KEY/previous.tar
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 004 moving latest.tar to previous.tar. Corrective action has to be taken manualy"
zabbix "${KEY}:Error 004"
zabbix_err "${KEY}:Error 004"
return 1
fi
)
......@@ -130,7 +136,7 @@ irods_commit(){
imv $KEY/staging.tar $KEY/latest.tar
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 005 moving statging.tar to latest.tar. Corrective action has to be taken manualy"
zabbix "${KEY}:Error 005"
zabbix_err "${KEY}:Error 005"
return 1
fi
ils $KEY/previous_to_delete.tar 2>/dev/null && irm -f $KEY/previous_to_delete.tar
......@@ -186,7 +192,7 @@ echo "[$KEY] Starting dump from ${SNAPSHOT_DIR}"
tar cf $RESIFDD_WORKDIR/$KEY.tar --exclude portalproducts -C $SNAPSHOT_DIR $SNAPSHOT_DIR
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 001 while creating tar archive."
zabbix "${KEY}:Error 001"
zabbix_err "${KEY}:Error 001"
exit 1
fi
......@@ -223,8 +229,8 @@ for dir in $(find . -maxdepth 3 -type d | sort); do
if [[ $? -ne 0 ]]; then
# Something went wrong creating archive. Exit
echo "[$KEY] Error 007 creating tar"
# Send key to zabbix
zabbix "$KEY:Error 007"
# Send key to zabbix_err
zabbix_err "$KEY:Error 007"
continue
fi
# Check if file exists on irods server
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment