Skip to content

Commit

Permalink
fixing service autoumatic restarts by disableing services at shutdoww… (
Browse files Browse the repository at this point in the history
#50)

* fixing service autoumatic restarts by disableing services at shutdowwn. Also removing an attempt to start the docker container for geneva a second time

* slight change to make thins uniform

---------

Co-authored-by: Ubuntu <rafsalas@ub20n8855000001.orxxfqth034upnhnpwma2s5jtc.ax.internal.cloudapp.net>
  • Loading branch information
rafsalas19 and Ubuntu authored Apr 6, 2023
1 parent f1a7864 commit 65b91fc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
9 changes: 0 additions & 9 deletions linux_service/configure_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,3 @@ then
fi

systemctl daemon-reload

# enable exporter services
systemctl enable moneo@node_exporter.service
systemctl enable moneo@net_exporter.service
systemctl enable moneo@nvidia_exporter.service
if [[ -n $PUBLISHER ]];
then
systemctl enable moneo_publisher.service
fi
2 changes: 1 addition & 1 deletion linux_service/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ After=network.target

[Service]
Type=simple
Restart=always
Restart=no
ExecStartPre=<Moneo_Path>/linux_service/moneo_prestart.sh <Moneo_Path> %i.py
ExecStart=/usr/bin/python3 /tmp/moneo-worker/exporters/%i.py
User=root
Expand Down
2 changes: 1 addition & 1 deletion linux_service/moneo_publisher.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ After=network.target

[Service]
Type=simple
Restart=always
Restart=no
ExecStartPre=<Moneo_Path>/linux_service/moneo_prestart.sh <Moneo_Path> metrics_publisher.py
ExecStart=/usr/bin/python3 /tmp/moneo-worker/publisher/metrics_publisher.py <pub-type>
User=root
Expand Down
8 changes: 7 additions & 1 deletion linux_service/start_moneo_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
PUBLISHER=$1
MONEO_PATH=$2

systemctl enable moneo@node_exporter.service
systemctl enable moneo@net_exporter.service
systemctl enable moneo@nvidia_exporter.service

systemctl start moneo@node_exporter.service
systemctl start moneo@net_exporter.service
systemctl start moneo@nvidia_exporter.service
Expand All @@ -11,12 +15,14 @@ then
if [ "$PUBLISHER" = "geneva" ] && [ -d $MONEO_PATH ];
then
#starts Geneva agent
$MONEO_PATH/src/worker/start_geneva.sh cert $MONEO_PATH/src/worker/publisher/config/geneva_config.json
$MONEO_PATH/src/worker/start_geneva.sh cert $MONEO_PATH/src/worker/publisher/config
sleep 5 # wait a bit for the exporters to start
systemctl enable moneo_publisher.service
systemctl start moneo_publisher.service
elif [ "$PUBLISHER" = "azure_monitor" ];
then
sleep 5 # wait a bit for the exporters to start
systemctl enable moneo_publisher.service
systemctl start moneo_publisher.service
else
echo "Either PUBLISHER OR MONEO_PATH unrecognized. PUBLISHER can be geneva or azure_monitor. If publisher is geneva MONEO_PATH must be defined."
Expand Down
5 changes: 5 additions & 0 deletions linux_service/stop_moneo_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ systemctl stop moneo@net_exporter.service
systemctl stop moneo@nvidia_exporter.service
systemctl stop moneo_publisher.service

systemctl disable moneo@node_exporter.service
systemctl disable moneo@net_exporter.service
systemctl disable moneo@nvidia_exporter.service
systemctl disable moneo_publisher.service

if [[ $(docker ps -a | grep genevamdmagent) ]]; then
echo "Stopping Geneva Metrics Extension(MA) container"
docker stop genevamdmagent
Expand Down
8 changes: 0 additions & 8 deletions src/worker/start_geneva.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,3 @@ else
# Unsupported auth type
echo "Publisher auth not supported"
fi

# Run Geneva Metrics Extension(MA) docker container
sudo docker run -d --name=$CONTAINER_NAME --net=host --uts=host \
-v $GENEVA_DIR:/etc/geneva/ -e MDM_ACCOUNT=$GENEVA_ACCOUNT_NAME \
-e MDM_INPUT="otlp_grpc,statsd_udp" -e MDM_LOG_LEVEL="info" \
-e CONFIG_OVERRIDES_FILE="/etc/geneva/auth_umi.json" \
-e METRIC_ENDPOINT=$METRIC_ENDPOINT \
genevamdm

0 comments on commit 65b91fc

Please sign in to comment.