MONITORING LAYER : prometheus node_exporter + DRAGONS prometheus/grafana platform

This commit is contained in:
fred 2024-04-14 16:31:55 +02:00
parent 1d4527c72e
commit a9a7f23a3b
4 changed files with 29 additions and 5 deletions

View File

@ -69,12 +69,16 @@ echo
PORT=22000 PORT=22000
PORT=$((PORT+${RANDOM:0:3})) PORT=$((PORT+${RANDOM:0:3}))
#######################################################################
## Adapt $USER for the UPlanet /home/$USER Private Swarm specific one
#######################################################################
echo '#!/bin/bash echo '#!/bin/bash
if [[ ! $(ipfs p2p ls | grep x/ssh-'${IPFSNODEID}') ]]; then if [[ ! $(ipfs p2p ls | grep x/ssh-'${IPFSNODEID}') ]]; then
ipfs --timeout=10s ping -n 4 /p2p/'${IPFSNODEID}' ipfs --timeout=10s ping -n 4 /p2p/'${IPFSNODEID}'
[[ $? == 0 ]] \ [[ $? == 0 ]] \
&& ipfs p2p forward /x/ssh-'${IPFSNODEID}' /ip4/127.0.0.1/tcp/'${PORT}' /p2p/'${IPFSNODEID}' \ && ipfs p2p forward /x/ssh-'${IPFSNODEID}' /ip4/127.0.0.1/tcp/'${PORT}' /p2p/'${IPFSNODEID}' \
&& ssh '${USER}'@127.0.0.1 -p '${PORT}' \ && ssh \$USER@127.0.0.1 -p '${PORT}' \
|| echo "CONTACT IPFSNODEID FAILED - ERROR -" || echo "CONTACT IPFSNODEID FAILED - ERROR -"
fi fi
' > ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh ' > ~/.zen/tmp/${IPFSNODEID}/x_ssh.sh
@ -108,10 +112,17 @@ echo "
'------' \ '------' \
" "
############################################ ############################################
echo "CONNECT WITH THIS COMMAND" echo "CONNECT WITH THIS COMMAND"
echo "ipfs cat /ipns/${IPFSNODEID}/x_ssh.sh | bash" echo "ipfs cat /ipns/${IPFSNODEID}/x_ssh.sh | bash"
############################################ ############################################
## PROMETHEUS NODE
if [[ -s ~/.zen/prometheus/prometheus ]]; then
echo "UPDATING ~/.zen/prometheus/prometheus.yml"
## ADD ALL SWARM NODES TO MONITORING LIST for prometheus (GRAFANA) node
fi
exit 0 exit 0

10
install.prometheus_node_exporter_linux.sh Normal file → Executable file
View File

@ -9,9 +9,9 @@ cd ~/.zen/tmp
# Check processor architecture # Check processor architecture
architecture=$(uname -m) architecture=$(uname -m)
###################################################### ##############################################################
## IF $1 == "GRAFANA" ## "GRAFANA" NODE + PROMETHEUS GATEWAY (CONSUME DISK SPACE !)
###################################################### ##############################################################
if [[ "$1" == "GRAFANA" && ! -d ~/.zen/prometheus ]]; then if [[ "$1" == "GRAFANA" && ! -d ~/.zen/prometheus ]]; then
# Grafana # Grafana
sudo apt-get install -y adduser libfontconfig1 musl sudo apt-get install -y adduser libfontconfig1 musl
@ -41,8 +41,12 @@ if [[ "$1" == "GRAFANA" && ! -d ~/.zen/prometheus ]]; then
tar -xvzf prometheus.tar.gz tar -xvzf prometheus.tar.gz
mv $(ls -d prometheus-*) ~/.zen/prometheus mv $(ls -d prometheus-*) ~/.zen/prometheus
## prometheus.
fi fi
###################################################### ######################################################
## PROMETHEUS node_exporter ## PROMETHEUS node_exporter
###################################################### ######################################################

View File

@ -153,6 +153,12 @@ if [[ $USER != 'xbian' ]]; then
fi fi
################################################### NODE MONITORING LAYER
[[ ! $isLAN ]] && plus="GRAFANA"
echo "############# INSTALL PROMETHEUS NODE EXPORTER $plus"
${MY_PATH}/install.prometheus_node_exporter_linux.sh $plus
###############################################################
##################### #####################
#### ~/.bashrc #### ~/.bashrc
echo "########################### ♥BOX" echo "########################### ♥BOX"

View File

@ -40,4 +40,7 @@ test=$tw$ipfs$keygen$jaklis$amzqr
[[ ${test:2:2} == "11" ]] && echo "CRYPTO LAYER MALFUNCTION" [[ ${test:2:2} == "11" ]] && echo "CRYPTO LAYER MALFUNCTION"
[[ ${test::2} == "01" ]] && echo "IPFS DAEMON IS ABSENT" [[ ${test::2} == "01" ]] && echo "IPFS DAEMON IS ABSENT"
### PROMETHEUS NODE EXPORTER ##################
ls /usr/local/bin/node_exporter
exit 0 exit 0