Skip to content

Commit

Permalink
TES-453 Added Azure Application Insights agent
Browse files Browse the repository at this point in the history
Added logging of the backup script output
  • Loading branch information
viktor-ribchev committed Feb 1, 2024
1 parent 3b9148e commit d0daba7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion files/graphdb.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GDB_JAVA_OPTS="-Dgraphdb.home=/var/opt/graphdb/node -Dgraphdb.home.conf=/etc/graphdb -Dhttp.socket.keepalive=true -XX:MaxRAMPercentage=85.0 -XX:-UseCompressedOops"
GDB_JAVA_OPTS="-javaagent:/opt/graphdb/applicationinsights-agent.jar -Dgraphdb.home=/var/opt/graphdb/node -Dgraphdb.home.conf=/etc/graphdb -Dhttp.socket.keepalive=true -XX:MaxRAMPercentage=85.0 -XX:-UseCompressedOops"
10 changes: 7 additions & 3 deletions files/graphdb_backup
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ retry_count=0

perform_backup() {
while [ "$retry_count" -lt "$max_retries" ]; do
current_time=$(date +"%T %Y-%m-%d")
echo "#####################################"
echo "Begin backup creation ${current_time}"
echo "#####################################"
start_time=$(date +%s)

response_code=$(curl -X POST --write-out %{http_code} --silent --output /dev/null \
Expand Down Expand Up @@ -62,11 +66,11 @@ IS_CLUSTER=$(
if [ "$IS_CLUSTER" == 200 ]; then
# Checks if the current GraphDB instance is Leader, otherwise exits.
if [ "$NODE_STATE" != "LEADER" ]; then
echo "The current node is not the leader, but $NODE_STATE"
echo "The current node is not the leader, but $NODE_STATE. Exiting"
exit 0
fi
perform_backup
perform_backup | tee -a /var/opt/graphdb/node/graphdb_backup.log
elif [ "$IS_CLUSTER" == 503 ]; then
perform_backup
perform_backup | tee -a /var/opt/graphdb/node/graphdb_backup.log
fi

8 changes: 8 additions & 0 deletions files/install_graphdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ echo 'fs.file-max = 262144' | tee -a /etc/sysctl.conf

sysctl -p

echo "##################################################"
echo "# Setting Azure Application Insights agent #"
echo "##################################################"

wget -P /opt/graphdb/ https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.19/applicationinsights-agent-3.4.19.jar
ln -s /opt/graphdb/applicationinsights-agent-3.4.19.jar /opt/graphdb/applicationinsights-agent.jar
chown graphdb:graphdb /opt/graphdb/applicationinsights-agent.jar

echo "###################################"
echo "# Provisioning Backup Script #"
echo "###################################"
Expand Down

0 comments on commit d0daba7

Please sign in to comment.