Monitoring

This commit is contained in:
Martin Lablans
2022-10-06 09:54:21 +02:00
parent 945a862a68
commit 0dfeee05d6
9 changed files with 96 additions and 31 deletions

View File

@@ -1,9 +1,11 @@
#!/bin/bash -e
source lib/log.sh
exitIfNotRoot() {
if [ "$EUID" -ne 0 ]; then
log "ERROR" "Please run as root"
exit 1
fail_and_report 1 "Please run as root"
fi
}
@@ -16,10 +18,6 @@ checkOwner(){
return 0
}
log() {
echo -e "$(date +'%Y-%m-%d %T')" "$1:" "$2"
}
printUsage() {
echo "Usage: bridgehead start|stop|update|install|uninstall PROJECTNAME"
echo "PROJECTNAME should be one of ccp|nngm|gbn"
@@ -28,7 +26,7 @@ printUsage() {
checkRequirements() {
if ! lib/prerequisites.sh; then
log "ERROR" "Validating Prerequisites failed, please fix the error(s) above this line."
exit 1
fail_and_report 1 "Validating prerequisites failed."
else
return 0
fi
@@ -97,6 +95,18 @@ assertVarsNotEmpty() {
return 0
}
fixPermissions() {
chown -R bridgehead /etc/bridgehead .
}
source lib/monitoring.sh
fail_and_report() {
log ERROR "$2"
hc_send $1 "$2"
exit $1
}
##Setting Network properties
export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}');
export HOST=$(hostname)