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 / 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
* Create configuration file `config.ini`
```ini
[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
org=keenetic
# 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
# For influx v1.x DB name
bucket=keenetic
@@ -70,9 +68,9 @@ skip_auth=true
# 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:
keenetic-grafana-monitoring:
image: techh/keenetic-grafana-monitoring:2.0.1
image: techh/keenetic-grafana-monitoring:2.0.2
container_name: keenetic-grafana-monitoring
# environment:
# - TZ=Europe/Kiev
@@ -109,6 +107,23 @@ services:
- 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
* 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
`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

@@ -1,29 +1,40 @@
{
"metrics" : [
"metrics": [
{
"command": "processes",
"root" : "$.process.[*]",
"tags" : {
"root": "$.process.[*]",
"tags": {
"name": "$.comm",
"pid": "$.pid"
},
"values" : {
"values": {
"cpu": "$.statistics.cpu.cur",
"memory": "$.vm-size"
}
},
{
"command": "interface",
"root": "$",
"param": {
"name": "WifiMaster0"
},
"tags": {},
"values": {
"temperature": "$.temperature"
}
},
{
"command": "ip hotspot",
"root" : "$.host[*]",
"tags" : {
"hostname" : "$.hostname",
"name" : "$.name",
"root": "$.host[*]",
"tags": {
"hostname": "$.hostname",
"name": "$.name",
"ssid": "$.ssid",
"mode": "$.mode",
"ip": "$.ip",
"mac": "$.mac"
},
"values" : {
"values": {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"txrate": "$.txrate",
@@ -35,15 +46,15 @@
},
{
"command": "interface",
"root" : "$.*",
"tags" : {
"root": "$.*",
"tags": {
"id": "$.id",
"type": "$.type",
"description": "$.description",
"interface-name": "$.interface-name",
"address": "$.address"
},
"values" : {
"values": {
"mtu": "$.mtu",
"uptime": "$.uptime",
"tx-queue": "$.tx-queue",
@@ -52,11 +63,11 @@
},
{
"command": "system",
"root" : "$",
"tags" : {
"hostname" : "$.hostname"
"root": "$",
"tags": {
"hostname": "$.hostname"
},
"values" : {
"values": {
"cpuload": "$.cpuload",
"memtotal": "$.memtotal",
"memfree": "$.memfree",
@@ -69,9 +80,9 @@
},
{
"command": "internet status",
"root" : "$",
"tags" : {},
"values" : {
"root": "$",
"tags": {},
"values": {
"internet": "$.internet",
"gateway-accessible": "$.gateway-accessible",
"dns-accessible": "$.dns-accessible",
@@ -81,25 +92,25 @@
},
{
"command": "media",
"root" : "$.*.partition.[*]",
"tags" : {
"label" : "$.label",
"uuid" : "$.uuid"
"root": "$.*.partition.[*]",
"tags": {
"label": "$.label",
"uuid": "$.uuid"
},
"values" : {
"values": {
"total": "$.total",
"free": "$.free",
"state" : "$.state"
"state": "$.state"
}
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "ISP"
"root": "$",
"param": {
"name": "ISP"
},
"tags" : {},
"values" : {
"tags": {},
"values": {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
@@ -108,12 +119,12 @@
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "AccessPoint"
"root": "$",
"param": {
"name": "AccessPoint"
},
"tags" : {},
"values" : {
"tags": {},
"values": {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
@@ -122,12 +133,12 @@
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "AccessPoint_5G"
"root": "$",
"param": {
"name": "AccessPoint_5G"
},
"tags" : {},
"values" : {
"tags": {},
"values": {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
@@ -136,12 +147,12 @@
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "GigabitEthernet0"
"root": "$",
"param": {
"name": "GigabitEthernet0"
},
"tags" : {},
"values" : {
"tags": {},
"values": {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
@@ -150,12 +161,12 @@
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "PPTP0"
"root": "$",
"param": {
"name": "PPTP0"
},
"tags" : {},
"values" : {
"tags": {},
"values": {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
@@ -163,4 +174,4 @@
}
}
]
}
}

View File

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