Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fed102361d | ||
|
|
8d139554f5 | ||
|
|
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,
|
||||||
|
|||||||
28
README.md
28
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Docker Based Latency Monitor
|
# Docker Based Latency Monitor
|
||||||
|
|
||||||
Docker container which tracks latency of one or many hosts and reports to InfluxDBv2.
|
Docker container(s) which tracks latency of one or many hosts and reports to InfluxDBv2.
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ You can use it in *standalone* or *full stack* mode.
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Docker
|
- Docker (CE)
|
||||||
- Docker-Compose
|
- Docker-Compose
|
||||||
- InfluxDB Version >= 2
|
- InfluxDB Version >= 2
|
||||||
- pythonping needs root privileges so same for the container
|
- pythonping needs root privileges so same for the container
|
||||||
@@ -47,9 +47,9 @@ Also some influx connection options are just configurable via config file but no
|
|||||||
|
|
||||||
### Behaviour
|
### Behaviour
|
||||||
|
|
||||||
Per default the python influx connector will cache all replies and sends them bundled every 30 seconds to the Influx DB.
|
Per default the used python influxdb connector will cache all replies and sends them bundled every 30 seconds to the Influx DB.
|
||||||
|
|
||||||
The container will be build at 1st start.
|
Actually the latency-monitor container is build on demand, a dockerhub image is on the roadmap...
|
||||||
|
|
||||||
You can find everything under *./Docker_Build/* and in the python program itself [latency_monitor.py](./Docker_Build/latency_monitor.py)
|
You can find everything under *./Docker_Build/* and in the python program itself [latency_monitor.py](./Docker_Build/latency_monitor.py)
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ docker latency-monitor -v ./latency-monitor/config.ini:/app/config.ini:ro
|
|||||||
|
|
||||||
## Configuration (Standalone)
|
## Configuration (Standalone)
|
||||||
|
|
||||||
1st thing to do is creating the *docker-compose.yml from [docker-compose-standalone.yml](./docker-compose-standalone.yml):
|
1st thing to do is creating the *docker-compose.yml* from [docker-compose-standalone.yml](./docker-compose-standalone.yml):
|
||||||
|
|
||||||
```
|
```
|
||||||
cp docker-compose-standalone.yml docker-compose.yml
|
cp docker-compose-standalone.yml docker-compose.yml
|
||||||
@@ -147,7 +147,7 @@ Just create a valid *.env* File by:
|
|||||||
cp env .env
|
cp env .env
|
||||||
```
|
```
|
||||||
|
|
||||||
and editing it to your needs.
|
and edit it to your needs.
|
||||||
|
|
||||||
After everyting within *.env* is in order just do:
|
After everyting within *.env* is in order just do:
|
||||||
|
|
||||||
@@ -159,10 +159,14 @@ Everything should be right in place now.
|
|||||||
|
|
||||||
Just the certificates are missing look [here](#certificate)
|
Just the certificates are missing look [here](#certificate)
|
||||||
|
|
||||||
|
Now run it and mybe pick a example dashboard for grafana from [here](#grafana-dashboard-examples)
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-----
|
-----
|
||||||
|
|
||||||
### WTF maual mode
|
### WTF manual mode
|
||||||
|
|
||||||
|
REALLY???
|
||||||
|
|
||||||
You need to set all on your own:
|
You need to set all on your own:
|
||||||
|
|
||||||
@@ -228,6 +232,8 @@ Everything should be right in place now.
|
|||||||
|
|
||||||
Just the certificates are missing look [here](#certificate)
|
Just the certificates are missing look [here](#certificate)
|
||||||
|
|
||||||
|
Now run it and mybe pick a example dashboard for grafana from [here](#grafana-dashboard-examples)
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-----
|
-----
|
||||||
|
|
||||||
@@ -253,7 +259,7 @@ Thats it
|
|||||||
|
|
||||||
## Grafana Dashboard Examples
|
## Grafana Dashboard Examples
|
||||||
|
|
||||||
Within the local path *./examples/grafana/* you can find example *.json* files which can be imported to grafana as dashboards to give you a first point to start with.
|
Within the local path [./examples/grafana/](./examples/grafana/) you can find example *.json* files which can be imported to grafana as dashboards to give you a first point to start with.
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
@@ -274,6 +280,12 @@ Contributors names and contact info
|
|||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
* v0.2a
|
||||||
|
* fixed some missing variables
|
||||||
|
* fixe a missing integer declaration in latency-monitor
|
||||||
|
* added automatic config creation for full-stack
|
||||||
|
* cleanups
|
||||||
|
|
||||||
* v0.1
|
* v0.1
|
||||||
* Initial Release
|
* Initial Release
|
||||||
|
|
||||||
|
|||||||
@@ -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