File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66# background thread to monitor system settings changes
77# print("FLASK_ENV: ", os.getenv('FLASK_ENV'))
88# # if os.getenv('FLASK_ENV') == 'production':
9- start_website_monitoring () # Starts pinging active websites
10- fetch_file_metrics_task ()
9+ # start_website_monitoring() # Starts pinging active websites
10+ # fetch_file_metrics_task()
1111monitor_settings () # Starts monitoring for system logging changes
1212
1313if __name__ == "__main__" :
Original file line number Diff line number Diff line change 4747 raise ValueError ("Please set the INFLUXDB_TOKEN environment variable." )
4848org = "systemguard"
4949url = "http://localhost:8086"
50- bucket = "_monitoring "
50+ bucket = "system_metrics "
5151try :
5252 influx_client = InfluxDBClient (url = url , token = INFLUXDB_TOKEN , org = org )
53- bucket = "_monitoring "
53+ bucket = "system_metrics "
5454 write_api = influx_client .write_api (write_options = SYNCHRONOUS )
5555 query_api = influx_client .query_api ()
5656 logger .info ("Connected to InfluxDB successfully" )
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ CONTAINER_NAME="influxdb"
66NETWORK_NAME=" influx_network"
77DATA_DIR=" ./influxdb_data"
88INFLUXDB_USER=" admin" # Change this to your desired username
9- INFLUXDB_PASSWORD=" admin_passwor " # Change this to your desired password
9+ INFLUXDB_PASSWORD=" admin_password " # Change this to your desired password
1010INFLUXDB_ORG=" systemguard" # Change this to your desired organization name
1111INFLUXDB_BUCKET=" system_metrics" # Change this to your desired initial bucket (database) name
12- INFLUXDB_TOKEN=" GixPn4ZmYuPyzPtj2XivfALmtHUaatBTK85ZjSe78P8NdbM_J9426tTPoqnbQDCok_NgBreOaqzdmoGxJ3UfsA=="
12+ # demo influxdb token | change this to your own token
13+ INFLUXDB_TOKEN=" "
1314
1415# Export the INFLUXDB_TOKEN to be used later in your app
1516export " INFLUXDB_TOKEN" =$INFLUXDB_TOKEN
@@ -45,6 +46,7 @@ echo "Running InfluxDB container..."
4546docker run -d \
4647 --name $CONTAINER_NAME \
4748 --network $NETWORK_NAME \
49+ --restart=always \
4850 -p 8086:8086 \
4951 -v $PWD /$DATA_DIR :/var/lib/influxdb2 \
5052 -e DOCKER_INFLUXDB_INIT_MODE=setup \
@@ -55,5 +57,6 @@ docker run -d \
5557 -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=$INFLUXDB_TOKEN \
5658 influxdb:$INFLUXDB_VERSION
5759
60+
5861# Output completion message
5962echo " InfluxDB setup completed! Access it at http://localhost:8086 with your credentials."
You can’t perform that action at this time.
0 commit comments