Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb9263781e | ||
|
|
abd98c49b8 | ||
|
|
5e6bd76557 |
@@ -82,7 +82,7 @@ class MyInfluxDB():
|
|||||||
def write(self, host, host_location, ping_response):
|
def write(self, host, host_location, ping_response):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.host_location = host_location
|
self.host_location = host_location
|
||||||
self.ping_response = ping_response
|
self.ping_response = int(ping_response)
|
||||||
self.influx_timestamp = int(time_ns())
|
self.influx_timestamp = int(time_ns())
|
||||||
self.data_point = Point("latency_monitor").tag("location", self.host_location).tag("host", self.host).field("latency", self.ping_response).time(self.influx_timestamp)
|
self.data_point = Point("latency_monitor").tag("location", self.host_location).tag("host", self.host).field("latency", self.ping_response).time(self.influx_timestamp)
|
||||||
self.write_api.write(bucket=self.INFX_BUCKET,
|
self.write_api.write(bucket=self.INFX_BUCKET,
|
||||||
|
|||||||
+6
-4
@@ -14,12 +14,14 @@ MyScriptPath=`dirname $0`
|
|||||||
MyScriptPathContainer="$MyScriptPath/CONTAINER/"
|
MyScriptPathContainer="$MyScriptPath/CONTAINER/"
|
||||||
|
|
||||||
# Replace .env MyPath Path with local path if NOT changed
|
# Replace .env MyPath Path with local path if NOT changed
|
||||||
echo "CHANGE: while not set, changing MyPath in .env to $MyScriptPathContainer"
|
|
||||||
sed -i -e "s#/YOUR_PATH_TO_CONTAINER_STATIC_DATA#$MyScriptPathContainer#g" .env
|
sed -i -e "s#/YOUR_PATH_TO_CONTAINER_STATIC_DATA#$MyScriptPathContainer#g" .env
|
||||||
|
|
||||||
|
|
||||||
# Read variables from .env file
|
# Read variables from .env file
|
||||||
source .env
|
source .env
|
||||||
|
|
||||||
|
echo "INFO: MyPath is $MyPath"
|
||||||
|
|
||||||
# Make relevant direcotries
|
# Make relevant direcotries
|
||||||
echo "MKDIR: creating $MyPath"
|
echo "MKDIR: creating $MyPath"
|
||||||
mkdir -p $MyPath
|
mkdir -p $MyPath
|
||||||
@@ -35,7 +37,7 @@ sed -i -e "s/PLACE_YOUR_FQDN_HERE/$MyFQDN/g" $MyScriptPath/docker-compose.yml
|
|||||||
# Changes in grafana/provisioning/datasources/grafana-datasource.yml
|
# Changes in grafana/provisioning/datasources/grafana-datasource.yml
|
||||||
echo "CHANGE: replace YOUR_ADMIN_TOKEN with $INFLUX_TOKEN in $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
echo "CHANGE: replace YOUR_ADMIN_TOKEN with $INFLUX_TOKEN in $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
||||||
sed -i -e "s/YOUR_ADMIN_TOKEN/$INFLUX_TOKEN/g" $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
sed -i -e "s/YOUR_ADMIN_TOKEN/$INFLUX_TOKEN/g" $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
||||||
echo "CHANGE: replace YYOUR_ORGANIZATION with $INFLUX_ORG in $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
echo "CHANGE: replace YOUR_ORGANIZATION with $INFLUX_ORG in $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
||||||
sed -i -e "s/YOUR_ORGANIZATION/$INFLUX_ORG/g" $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
sed -i -e "s/YOUR_ORGANIZATION/$INFLUX_ORG/g" $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
||||||
echo "CHANGE: replace YOUR_BUCKET_NAME with $INFLUX_BUCKET in $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
echo "CHANGE: replace YOUR_BUCKET_NAME with $INFLUX_BUCKET in $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
||||||
sed -i -e "s/YOUR_BUCKET_NAME/$INFLUX_BUCKET/g" $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
sed -i -e "s/YOUR_BUCKET_NAME/$INFLUX_BUCKET/g" $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
||||||
@@ -43,8 +45,8 @@ sed -i -e "s/YOUR_BUCKET_NAME/$INFLUX_BUCKET/g" $MyScriptPath/grafana/provisioni
|
|||||||
# Correct owner and permissions to satisfy the containers
|
# Correct owner and permissions to satisfy the containers
|
||||||
echo "CHMOD: chmod -R 755 $MyPath"
|
echo "CHMOD: chmod -R 755 $MyPath"
|
||||||
chmod -R 755 $MyPath
|
chmod -R 755 $MyPath
|
||||||
echo "CHMOD: chmod 644 $MyScriptPath/grafana/datasources/grafana-datasource.yml"
|
echo "CHMOD: chmod 644 $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml"
|
||||||
chmod 644 $MyScriptPath/grafana/datasources/grafana-datasource.yml
|
chmod 644 $MyScriptPath/grafana/provisioning/datasources/grafana-datasource.yml
|
||||||
echo "CHOWN: chown -R 472.472 $MyPath/grafana/var_lib"
|
echo "CHOWN: chown -R 472.472 $MyPath/grafana/var_lib"
|
||||||
chown -R 472.472 $MyPath/grafana/var_lib
|
chown -R 472.472 $MyPath/grafana/var_lib
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user