Add temperature. Update doc.

This commit is contained in:
Vitaliy Skrypnyk
2023-05-26 22:52:25 +01:00
committed by Vitaliy Skrypnyk
parent 732e2a394d
commit 4a43deb9bf
3 changed files with 91 additions and 62 deletions

View File

@@ -18,21 +18,19 @@ Tested with KeeneticOS 3.5+
InfluxDB 2.x (recommended) and InfluxDB 1.8+ InfluxDB 2.x (recommended) and InfluxDB 1.8+
# InfluxDB 2.x / keenetic-grafana-monitoring 2.x migration manual
See on [wiki](https://github.com/vitaliy-sk/keenetic-grafana-monitoring/wiki/How-to-migrate-to-keenetic-grafana-monitoring-v2-and-Influx-v2)
# Preparation # Preparation
* Create configuration file `config.ini` * Create configuration file `config.ini`
```ini ```ini
[influx2] [influx2]
url=http://localhost:8086 # If you are using docker-compose it should be http://influxdb:8086
url=http://influxdb:8086
# For influx v1.x please use "-" as a value # For influx v1.x please use "-" as a value
org=keenetic org=keenetic
# For influx v1.x please use "username:password" as a token # For influx v1.x please use "username:password" as a token
token=<token> # See DOCKER_INFLUXDB_INIT_ADMIN_TOKEN in docker-compose.yml
token=admin_token
timeout=6000 timeout=6000
# For influx v1.x DB name # For influx v1.x DB name
bucket=keenetic bucket=keenetic
@@ -70,9 +68,9 @@ skip_auth=true
# Run # Run
There are two options, you can run collector directly on the router or in Docker on separate host. There are two options, you can run the collector directly on the router or in Docker on a separate host.
## Run in Docker on seprate host (recommended) ## Run in Docker on a separate host (recommended)
``` ```
--- ---
@@ -81,7 +79,7 @@ version: '3.7'
services: services:
keenetic-grafana-monitoring: keenetic-grafana-monitoring:
image: techh/keenetic-grafana-monitoring:2.0.1 image: techh/keenetic-grafana-monitoring:2.0.2
container_name: keenetic-grafana-monitoring container_name: keenetic-grafana-monitoring
# environment: # environment:
# - TZ=Europe/Kiev # - TZ=Europe/Kiev
@@ -109,6 +107,23 @@ services:
- DOCKER_INFLUXDB_INIT_PASSWORD=password - DOCKER_INFLUXDB_INIT_PASSWORD=password
``` ```
## Connect Grafana
Update your Grafana connection config
* Configuration -> Data sources
* Click add custom header
* Add header:
```
Authorization Token <TOKEN_VALUE>
```
**"Token"** word should be before the token value itself
Do not specify username/password
![Example](https://github.com/vitaliy-sk/keenetic-grafana-monitoring/assets/2773025/a3239473-8dc0-4bdc-a2d0-4b4719b810c6)
## Run on router ## Run on router
* Copy repository content to your router `/opt/home/keenetic-grafana-monitoring` * Copy repository content to your router `/opt/home/keenetic-grafana-monitoring`
@@ -129,3 +144,7 @@ nohup python /opt/home/keenetic-grafana-monitoring/keentic_influxdb_exporter.py
# Build Docker image # Build Docker image
`docker build -t keenetic-grafana-monitoring .` `docker build -t keenetic-grafana-monitoring .`
# InfluxDB 2.x / keenetic-grafana-monitoring 2.x migration manual
See on [wiki](https://github.com/vitaliy-sk/keenetic-grafana-monitoring/wiki/How-to-migrate-to-keenetic-grafana-monitoring-v2-and-Influx-v2)

View File

@@ -12,6 +12,17 @@
"memory": "$.vm-size" "memory": "$.vm-size"
} }
}, },
{
"command": "interface",
"root": "$",
"param": {
"name": "WifiMaster0"
},
"tags": {},
"values": {
"temperature": "$.temperature"
}
},
{ {
"command": "ip hotspot", "command": "ip hotspot",
"root": "$.host[*]", "root": "$.host[*]",

View File

@@ -96,8 +96,7 @@ class KeeneticCollector(object):
if __name__ == '__main__': if __name__ == '__main__':
logging.info("\n\n" + logging.info("\n\n" + " _ __ _ _ _____ _ _ _ \n | |/ / | | (_) / ____| | | | | | \n | ' / ___ ___ _ __ ___| |_ _ ___ | | ___ | | | ___ ___| |_ ___ _ __🇺🇦 🇺🇦 🇺🇦 \n | < / _ \/ _ \ '_ \ / _ \ __| |/ __| | | / _ \| | |/ _ \/ __| __/ _ \| '__|\n | . \ __/ __/ | | | __/ |_| | (__ | |___| (_) | | | __/ (__| || (_) | | \n |_|\_\___|\___|_| |_|\___|\__|_|\___| \_____\___/|_|_|\___|\___|\__\___/|_| \n\n")
" _ __ _ _ _____ _ _ _ \n | |/ / | | (_) / ____| | | | | | \n | ' / ___ ___ _ __ ___| |_ _ ___ | | ___ | | | ___ ___| |_ ___ _ __ \n | < / _ \/ _ \ '_ \ / _ \ __| |/ __| | | / _ \| | |/ _ \/ __| __/ _ \| '__|\n | . \ __/ __/ | | | __/ |_| | (__ | |___| (_) | | | __/ (__| || (_) | | \n |_|\_\___|\___|_| |_|\___|\__|_|\___| \_____\___/|_|_|\___|\___|\__\___/|_| \n\n")
pwd = os.path.dirname(os.path.realpath(__file__)) pwd = os.path.dirname(os.path.realpath(__file__))
metrics_configuration = json.load(open(pwd + "/config/metrics.json", "r")) metrics_configuration = json.load(open(pwd + "/config/metrics.json", "r"))