File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # function to get the user name
4+ get_user_name () {
5+ if [ " $( whoami) " = " root" ]; then
6+ LOGNAME_USER=$( logname 2> /dev/null) # Redirect any error output to /dev/null
7+ if [ $? -ne 0 ]; then # Check if the exit status of the last command is not 0
8+ USER_NAME=$( cat /etc/passwd | grep ' /home' | cut -d: -f1 | tail -n 1)
9+ else
10+ USER_NAME=$LOGNAME_USER
11+ fi
12+ else
13+ USER_NAME=$( whoami)
14+ fi
15+ echo " $USER_NAME "
16+ }
17+
18+ USER_NAME=$( get_user_name)
319# Configuration
420CURRENT_SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
521CURRENT_DIR=" $CURRENT_SCRIPT_DIR "
622ROOT_DIR=" $( dirname " $( dirname " $CURRENT_DIR " ) " ) "
723PROMETHEUS_CONFIG_DIR=" $ROOT_DIR /prometheus_config"
824CONTAINER_NAME=" prometheus"
925PROMETHEUS_CONFIG=" $PROMETHEUS_CONFIG_DIR /prometheus.yml"
26+ PROMETHEUS_DATA_DIR=" /home/$USER_NAME /.database/prometheus"
1027PROMETHEUS_IMAGE=" prom/prometheus" # Add your image name if needed
1128NETWORK_NAME=" flask-prometheus-net" # Specify your network name
1229PROMETHEUS_PORT=" 9090" # Specify your port
3451 -p " $PROMETHEUS_PORT :$PROMETHEUS_PORT " \
3552 --restart always \
3653 -v " $PROMETHEUS_CONFIG :/etc/prometheus/prometheus.yml" \
54+ -v " PROMETHEUS_DATA_DIR:/prometheus" \
3755 " $PROMETHEUS_IMAGE " & > /dev/null
3856
3957 log " Prometheus container started successfully."
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ <h1>SystemGuard Active Targets</h1>
1111 < table >
1212 < thead >
1313 < tr >
14- < th > Job </ th >
14+ < th > Group </ th >
1515 < th > Instance</ th >
1616 < th > Health</ th >
1717 < th > Last Scrape</ th >
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ <h1>SystemGuard Targets</h1>
1414 < table class ="modern-table ">
1515 < thead >
1616 < tr >
17- < th > Job Name</ th >
18- < th > Targets</ th >
19- < th > Scrape Interval</ th >
20- < th > Actions </ th >
17+ < th > Group Name < i class =" fas fa-info-circle " title =" Job Name is the name of the service that is being monitored. " > </ i > </ th >
18+ < th > Targets < i class =" fas fa-info-circle " title =" Targets are the IP addresses of the services that are being monitored. " > </ i > </ th >
19+ < th > Scrape Interval < i class =" fas fa-info-circle " title =" Scrape Interval is the time interval between each scrape of the target. " > </ i > </ th >
20+ < th > New Interval < i class =" fas fa-info-circle " title =" Change the scrape interval of the target. " > </ i > </ th >
2121 </ tr >
2222 </ thead >
2323 < tbody >
@@ -32,7 +32,9 @@ <h1>SystemGuard Targets</h1>
3232 < form action ="{{ url_for('remove_target') }} " method ="post " class ="inline-form ">
3333 < input type ="hidden " name ="job_name " value ="{{ info.job_name }} ">
3434 < input type ="hidden " name ="target_to_remove " value ="{{ target }} ">
35- < input type ="submit " value ="Remove " class ="btn-danger ">
35+ < button type ="submit " class ="btn-danger ">
36+ < i class ="fas fa-times "> </ i > Remove
37+ </ button >
3638 </ form >
3739 </ li >
3840 {% endfor %}
@@ -62,7 +64,7 @@ <h2>Restart Prometheus Docker Service</h2>
6264 < div class ="section ">
6365 < h2 > Add New Target</ h2 >
6466 < form action ="{{ url_for('add_target') }} " method ="post " class ="add-target-form ">
65- < input type ="text " name ="job_name " placeholder ="Job Name " required class ="input-field ">
67+ < input type ="text " name ="job_name " placeholder ="Group Name " required class ="input-field ">
6668 < input type ="text " name ="new_target " placeholder ="New Target " required class ="input-field ">
6769 < input type ="text " name ="scrape_interval " placeholder ="Scrape Interval " required class ="input-field ">
6870 < br >
You can’t perform that action at this time.
0 commit comments