Uninstall node_exporter when removing OSM stack
[osm/devops.git] / installers / full_install_osm.sh
index 777c855..0bf2e20 100755 (executable)
@@ -194,6 +194,7 @@ function uninstall_lightweight() {
         else
             remove_stack $OSM_STACK_NAME
             remove_stack osm_elk
+            uninstall_prometheus_nodeexporter
         fi
         echo "Now osm docker images and volumes will be deleted"
         newgrp docker << EONG
@@ -615,6 +616,16 @@ function install_prometheus_nodeexporter(){
     return 0
 }
 
+function uninstall_prometheus_nodeexporter(){
+    sudo systemctl stop node_exporter
+    sudo systemctl disable node_exporter
+    sudo rm /etc/systemd/system/node_exporter.service
+    sudo systemctl daemon-reload
+    sudo userdel node_exporter
+    sudo rm /usr/local/bin/node_exporter
+    return 0
+}
+
 function install_from_lxdimages(){
     LXD_RELEASE=${RELEASE#"-R "}
     if [ -n "$LXD_REPOSITORY_PATH" ]; then