X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=e759c56605f7e1b77ed63d8a19e137b310d70ee2;hb=c26d90bf8c425638f43f639b220ec09770a52e0c;hp=777c855d7eb3354e14a6b7baf22af535baa8d6d2;hpb=e366b1a9f5405252757890bcbaa392d269fafad0;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 777c855d..e759c566 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -192,6 +192,7 @@ function uninstall_lightweight() { fi remove_k8s_namespace $OSM_STACK_NAME else + remove_stack $OSM_STACK_NAME remove_stack osm_elk fi @@ -602,16 +603,38 @@ function install_osmclient(){ } function install_prometheus_nodeexporter(){ - sudo useradd --no-create-home --shell /bin/false node_exporter - sudo wget -q https://github.com/prometheus/node_exporter/releases/download/v$PROMETHEUS_NODE_EXPORTER_TAG/node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64.tar.gz -P /tmp/ - sudo tar -C /tmp -xf /tmp/node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64.tar.gz - sudo cp /tmp/node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64/node_exporter /usr/local/bin - sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter - sudo rm -rf node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64* - sudo cp ${OSM_DEVOPS}/installers/docker/files/node_exporter.service /etc/systemd/system/node_exporter.service + if (systemctl -q is-active node_exporter) + then + echo "Node Exporter is already running." + else + echo "Node Exporter is not active, installing..." + if getent passwd node_exporter > /dev/null 2>&1; then + echo "node_exporter user exists" + else + echo "Creating user node_exporter" + sudo useradd --no-create-home --shell /bin/false node_exporter + fi + sudo wget -q https://github.com/prometheus/node_exporter/releases/download/v$PROMETHEUS_NODE_EXPORTER_TAG/node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64.tar.gz -P /tmp/ + sudo tar -C /tmp -xf /tmp/node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64.tar.gz + sudo cp /tmp/node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64/node_exporter /usr/local/bin + sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter + sudo rm -rf node_exporter-$PROMETHEUS_NODE_EXPORTER_TAG.linux-amd64* + sudo cp ${OSM_DEVOPS}/installers/docker/files/node_exporter.service /etc/systemd/system/node_exporter.service + sudo systemctl daemon-reload + sudo systemctl restart node_exporter + sudo systemctl enable node_exporter + echo "Node Exporter has been activated in this host." + fi + 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 systemctl restart node_exporter - sudo systemctl enable node_exporter + sudo userdel node_exporter + sudo rm /usr/local/bin/node_exporter return 0 } @@ -682,6 +705,7 @@ function install_juju() { echo "Installing juju" sudo snap install juju --classic [ -z "$INSTALL_NOLXD" ] && sudo dpkg-reconfigure -p medium lxd + [[ ":$PATH": != *":/snap/bin:"* ]] && PATH="/snap/bin:${PATH}" echo "Finished installation of juju" return 0 } @@ -931,6 +955,13 @@ function generate_docker_env_files() { $WORKDIR_SUDO sed -i "s|OSMMON_VCA_SECRET.*|OSMMON_VCA_SECRET=$OSM_VCA_SECRET|g" $OSM_DOCKER_WORK_DIR/mon.env fi + if ! grep -Fq "OSMMON_VCA_CACERT" $OSM_DOCKER_WORK_DIR/mon.env; then + echo "OSMMON_VCA_CACERT=${OSM_VCA_CACERT}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/mon.env + else + $WORKDIR_SUDO sed -i "s|OSMMON_VCA_CACERT.*|OSMMON_VCA_CACERT=${OSM_VCA_CACERT}|g" $OSM_DOCKER_WORK_DIR/mon.env + fi + + # POL if [ ! -f $OSM_DOCKER_WORK_DIR/pol.env ]; then echo "OSMPOL_SQL_DATABASE_URI=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/pol" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/pol.env @@ -1044,6 +1075,7 @@ function deploy_lightweight() { OSM_UI_PORT=80 OSM_MON_PORT=8662 OSM_PROM_PORT=9090 + OSM_PROM_CADVISOR_PORT=8080 OSM_PROM_HOSTPORT=9091 OSM_GRAFANA_PORT=3000 [ -n "$INSTALL_ELK" ] && OSM_ELK_PORT=5601 @@ -1056,6 +1088,7 @@ function deploy_lightweight() { OSM_PORTS+=(OSM_UI_PORTS=$OSM_UI_PORT) OSM_PORTS+=(OSM_MON_PORTS=$OSM_MON_PORT) OSM_PORTS+=(OSM_PROM_PORTS=$OSM_PROM_PORT) + OSM_PORTS+=(OSM_PROM_CADVISOR_PORTS=$OSM_PROM_CADVISOR_PORT) OSM_PORTS+=(OSM_GRAFANA_PORTS=$OSM_GRAFANA_PORT) #[ -n "$INSTALL_PERFMON" ] && OSM_PORTS+=(OSM_PM_PORTS=$OSM_PM_PORT) [ -n "$INSTALL_ELK" ] && OSM_PORTS+=(OSM_ELK_PORTS=$OSM_ELK_PORT) @@ -1066,6 +1099,7 @@ function deploy_lightweight() { OSM_PORTS+=(OSM_UI_PORTS=$OSM_UI_PORT:$OSM_UI_PORT) OSM_PORTS+=(OSM_MON_PORTS=$OSM_MON_PORT:$OSM_MON_PORT) OSM_PORTS+=(OSM_PROM_PORTS=$OSM_PROM_HOSTPORT:$OSM_PROM_PORT) + OSM_PORTS+=(OSM_PROM_CADVISOR_PORTS=$OSM_PROM_CADVISOR_PORT:$OSM_PROM_CADVISOR_PORT) OSM_PORTS+=(OSM_GRAFANA_PORTS=$OSM_GRAFANA_PORT:$OSM_GRAFANA_PORT) #[ -n "$INSTALL_PERFMON" ] && OSM_PORTS+=(OSM_PM_PORTS=$OSM_PM_PORT:$OSM_PM_PORT) [ -n "$INSTALL_ELK" ] && OSM_PORTS+=(OSM_ELK_PORTS=$OSM_ELK_PORT:$OSM_ELK_PORT)