├── .gitignore ├── src └── meshtastic_prometheus_exporter │ ├── __init__.py │ ├── __about__.py │ ├── util.py │ ├── nodeinfo.py │ ├── neighborinfo.py │ ├── metrics.py │ ├── telemetry.py │ └── __main__.py ├── Dockerfile ├── docker ├── grafana │ └── provisioning │ │ ├── datasources │ │ └── prometheus.yml │ │ └── dashboards │ │ └── meshtastic.yml └── prometheus.yml ├── .github ├── dependabot.yml ├── release.yml └── workflows │ └── trunk.yml ├── tests ├── test_nodeinfo.py ├── test_neighborinfo.py └── test_telemetry.py ├── docker-compose.yml ├── pyproject.toml ├── SUPPORTED_METRICS.md ├── README.md ├── grafana-dashboards ├── neighbor-info-net.json ├── neighbor-info-nodes.json ├── packets-nodes.json ├── packets-net.json ├── telemetry-net.json └── telemetry-nodes.json └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | .venv 3 | .idea 4 | /dist/ 5 | __pycache__/ 6 | .coverage -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present Artiom Mocrenco 2 | # 3 | # SPDX-License-Identifier: MIT 4 | -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/__about__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present Artiom Mocrenco 2 | # 3 | # SPDX-License-Identifier: MIT 4 | __version__ = "2.4" 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.13-slim 2 | WORKDIR /app 3 | COPY dist/meshtastic_prometheus_exporter*.whl /app 4 | RUN pip install --no-cache-dir /app/meshtastic_prometheus_exporter*.whl 5 | ENTRYPOINT ["meshtastic-prometheus-exporter"] -------------------------------------------------------------------------------- /docker/grafana/provisioning/datasources/prometheus.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: Prometheus 5 | type: prometheus 6 | access: proxy 7 | url: http://prometheus:9090 8 | uid: a7ee7fd2-ee1a-4400-b169-afa1f8c619ed 9 | -------------------------------------------------------------------------------- /docker/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. 3 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. 4 | # scrape_timeout is set to the global default (10s). 5 | 6 | scrape_configs: 7 | - job_name: "meshtastic" 8 | 9 | static_configs: 10 | - targets: ["exporter:9464"] 11 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | groups: 8 | opentelemetry: 9 | patterns: 10 | - "opentelemetry*" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | - package-ecosystem: "docker" 16 | directory: "/" 17 | schedule: 18 | interval: "monthly" 19 | - package-ecosystem: "docker-compose" 20 | directory: "/" 21 | schedule: 22 | interval: "monthly" 23 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | # .github/release.yml 2 | 3 | changelog: 4 | exclude: 5 | labels: 6 | - ignore-for-release 7 | categories: 8 | - title: "Exciting New Features :tada:" 9 | labels: 10 | - enhancement 11 | - title: "Grafana Changes :bar_chart:" 12 | labels: 13 | - "grafana" 14 | - title: "Prometheus Changes :fire:" 15 | labels: 16 | - "prometheus" 17 | - title: "Bug Fixes :lady_beetle:" 18 | labels: 19 | - "bug" 20 | - title: Other Changes 21 | labels: 22 | - "*" 23 | exclude: 24 | labels: 25 | - dependencies 26 | - title: Dependencies 27 | labels: 28 | - dependencies 29 | -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/util.py: -------------------------------------------------------------------------------- 1 | from cachetools import TTLCache 2 | 3 | 4 | def get_decoded_node_metadata_from_cache(cache, node: float, metadata: str): 5 | node_data = cache.get(node) 6 | if not node_data: 7 | return "unknown" 8 | v = node_data.get(metadata) 9 | if v is None: 10 | return "unknown" 11 | return v 12 | 13 | 14 | def save_node_metadata_in_cache(cache, node: float, node_info: dict, ex=3600 * 72): 15 | cache[node] = { 16 | "long_name": node_info["longName"], 17 | "short_name": node_info["shortName"], 18 | "hw_model": node_info["hwModel"], 19 | "is_licensed": str(node_info.get("isLicensed", False)), 20 | } 21 | # TTL is managed by cachetools, so 'ex' is set at cache creation 22 | -------------------------------------------------------------------------------- /docker/grafana/provisioning/dashboards/meshtastic.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | # an unique provider name. Required 5 | - name: 'Meshtastic Prometheus Exporter' 6 | # Org id. Default to 1 7 | orgId: 1 8 | # name of the dashboard folder. 9 | folder: '' 10 | # folder UID. will be automatically generated if not specified 11 | folderUid: '' 12 | # provider type. Default to 'file' 13 | type: file 14 | # disable dashboard deletion 15 | disableDeletion: false 16 | # how often Grafana will scan for changed dashboards 17 | updateIntervalSeconds: 10 18 | # allow updating provisioned dashboards from the UI 19 | allowUiUpdates: true 20 | options: 21 | # path to dashboard files on disk. Required when using the 'file' type 22 | path: /var/lib/grafana/dashboards 23 | # use folder names from filesystem to create folders in Grafana 24 | foldersFromFilesStructure: true 25 | -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/nodeinfo.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import time 3 | from meshtastic_prometheus_exporter.metrics import * 4 | import json 5 | from meshtastic_prometheus_exporter.util import save_node_metadata_in_cache 6 | 7 | logger = logging.getLogger("meshtastic_prometheus_exporter") 8 | 9 | 10 | def on_meshtastic_nodeinfo_app(cache, packet): 11 | node_info = packet["decoded"]["user"] 12 | 13 | logger.debug( 14 | f"Received MeshPacket {packet['id']} with NodeInfo `{json.dumps(node_info, default=repr)}`" 15 | ) 16 | 17 | source = packet["decoded"].get("source", packet["from"]) 18 | 19 | if source: 20 | save_node_metadata_in_cache(cache, source, node_info) 21 | 22 | node_info_attributes = { 23 | "source": source, 24 | "user": node_info["id"], 25 | "source_long_name": node_info["longName"], 26 | "source_short_name": node_info["shortName"], 27 | "is_licensed": str(node_info.get("isLicensed", 0)), 28 | } 29 | meshtastic_node_info_last_heard_timestamp_seconds.set( 30 | time.time(), attributes=node_info_attributes 31 | ) 32 | -------------------------------------------------------------------------------- /tests/test_nodeinfo.py: -------------------------------------------------------------------------------- 1 | import meshtastic_prometheus_exporter.__main__ as exporter 2 | import json 3 | from pytest_mock import MockerFixture 4 | 5 | 6 | def mocked_get_decoded_node_metadata_from_cache(cache, node: float, metadata: str): 7 | return "mocked" 8 | 9 | 10 | def test_nodeinfo(mocker: MockerFixture): 11 | packet = '{"from": 123456789, "to": 987654321, "decoded": {"portnum": "NODEINFO_APP", "bitfield": 0, "user": {"id": "!1fc44444", "longName": "namename", "shortName": "name", "macaddr": "CDIuwbaC", "hwModel": "TBEAM", "isLicensed": true}}, "id": 662811674, "rxTime": 1730000000, "rxSnr": 13.5, "hopLimit": 3, "rxRssi": -31, "hopStart": 3, "fromId": "!1fc44444", "toId": "^all"}' 12 | 13 | packet_decoded = json.loads(packet) 14 | 15 | mocker.patch( 16 | "meshtastic_prometheus_exporter.__main__.get_decoded_node_metadata_from_cache", 17 | new=mocked_get_decoded_node_metadata_from_cache, 18 | ) 19 | mock_set_last_heard_timestamp_seconds = mocker.patch.object( 20 | exporter.meshtastic_node_info_last_heard_timestamp_seconds, "set" 21 | ) 22 | mock_add_packets_total = mocker.patch.object( 23 | exporter.meshtastic_mesh_packets_total, "add" 24 | ) 25 | 26 | exporter.on_meshtastic_mesh_packet(packet_decoded) 27 | 28 | mock_set_last_heard_timestamp_seconds.assert_called_once() 29 | mock_add_packets_total.assert_called_once() 30 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | volumes: 4 | prometheus_data: 5 | grafana_data: 6 | 7 | services: 8 | prometheus: 9 | image: prom/prometheus:v3.5.0 10 | restart: unless-stopped 11 | ports: 12 | - "127.0.0.1:9090:9090" 13 | extra_hosts: 14 | - "host.docker.internal:host-gateway" 15 | volumes: 16 | - prometheus_data:/prometheus 17 | - ./docker/prometheus.yml:/etc/prometheus/prometheus.yml 18 | networks: 19 | - mesh-bridge 20 | grafana: 21 | image: grafana/grafana-oss:12.1.0 22 | restart: unless-stopped 23 | volumes: 24 | - grafana_data:/var/lib/grafana 25 | - ./docker/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources 26 | - ./docker/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards 27 | - ./grafana-dashboards:/var/lib/grafana/dashboards 28 | ports: 29 | - "0.0.0.0:3000:3000" 30 | networks: 31 | - mesh-bridge 32 | exporter: 33 | image: ghcr.io/hacktegic/meshtastic-prometheus-exporter:2.4 34 | restart: unless-stopped 35 | environment: 36 | - MESHTASTIC_INTERFACE=MQTT 37 | - MQTT_ADDRESS=mqtt.meshtastic.org 38 | - MQTT_USE_TLS=0 39 | - MQTT_PORT=1883 40 | - MQTT_KEEPALIVE=15 41 | - MQTT_USERNAME=meshdev 42 | - MQTT_PASSWORD=large4cats 43 | - MQTT_TOPIC=msh/EU_433/# 44 | networks: 45 | - mesh-bridge 46 | 47 | networks: 48 | mesh-bridge: 49 | driver: bridge 50 | -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/neighborinfo.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import json 3 | from meshtastic_prometheus_exporter.util import get_decoded_node_metadata_from_cache 4 | from meshtastic_prometheus_exporter.metrics import * 5 | 6 | logger = logging.getLogger("meshtastic_prometheus_exporter") 7 | 8 | 9 | def on_meshtastic_neighborinfo_app(cache, packet, source_long_name, source_short_name): 10 | neighbor_info = packet["decoded"]["neighborinfo"] 11 | logger.debug( 12 | f"Received MeshPacket {packet['id']} with NeighborInfo `{json.dumps(neighbor_info, default=repr)}`" 13 | ) 14 | 15 | source = neighbor_info["nodeId"] 16 | neighbor_info_attributes = { 17 | "source": source, 18 | "source_long_name": source_long_name, 19 | "source_short_name": source_short_name, 20 | } 21 | for n in neighbor_info["neighbors"]: 22 | neighbor_source = n["nodeId"] 23 | 24 | neighbor_info_attributes["neighbor_source"] = neighbor_source or "unknown" 25 | neighbor_info_attributes["neighbor_source_long_name"] = ( 26 | get_decoded_node_metadata_from_cache(cache, neighbor_source, "long_name") 27 | if source 28 | else "unknown" 29 | ) 30 | neighbor_info_attributes["neighbor_source_short_name"] = ( 31 | get_decoded_node_metadata_from_cache(cache, neighbor_source, "short_name") 32 | if source 33 | else "unknown" 34 | ) 35 | 36 | meshtastic_neighbor_info_snr_decibels.set( 37 | n["snr"], attributes=neighbor_info_attributes 38 | ) 39 | # https://buf.build/meshtastic/protobufs/file/main:meshtastic/mesh.proto#L1795 40 | # meshtastic_neighbor_info_last_rx_time.set( 41 | # n["rxTime"], attributes=neighbor_info_attributes 42 | # ) 43 | -------------------------------------------------------------------------------- /tests/test_neighborinfo.py: -------------------------------------------------------------------------------- 1 | import meshtastic_prometheus_exporter.__main__ as exporter 2 | import json 3 | from pytest_mock import MockerFixture 4 | from unittest.mock import call 5 | 6 | 7 | def mocked_get_decoded_node_metadata_from_cache(cache, node: float, metadata: str): 8 | return "mocked" 9 | 10 | 11 | def test_nodeinfo(mocker: MockerFixture): 12 | packet = '{"from": 123456789, "to": 987654321, "decoded": {"portnum": "NEIGHBORINFO_APP", "neighborinfo": {"nodeId": 123456789, "lastSentById": 123456789, "nodeBroadcastIntervalSecs": 3600, "neighbors": [{"nodeId": 123456711, "snr": 3.5}, {"nodeId": 123456722, "snr": 6.5}, {"nodeId": 123456733, "snr": -11.5}, {"nodeId": 123456744, "snr": 6.25}, {"nodeId": 123456755, "snr": 6.75}]}}, "id": 3117092156, "rxTime": 1702513724, "rxSnr": -10.0, "hopLimit": 2, "rxRssi": -119, "fromId": "!b6ffffac", "toId": "^all"}' 13 | 14 | packet_decoded = json.loads(packet) 15 | 16 | mocker.patch( 17 | "meshtastic_prometheus_exporter.neighborinfo.get_decoded_node_metadata_from_cache", 18 | new=mocked_get_decoded_node_metadata_from_cache, 19 | ) 20 | mocker.patch( 21 | "meshtastic_prometheus_exporter.__main__.get_decoded_node_metadata_from_cache", 22 | new=mocked_get_decoded_node_metadata_from_cache, 23 | ) 24 | mock_set_last_rx_time = mocker.patch.object( 25 | exporter.meshtastic_neighbor_info_last_rx_time, "set" 26 | ) 27 | mock_set_snr_decibels = mocker.patch.object( 28 | exporter.meshtastic_neighbor_info_snr_decibels, "set" 29 | ) 30 | mock_add_packets_total = mocker.patch.object( 31 | exporter.meshtastic_mesh_packets_total, "add" 32 | ) 33 | 34 | exporter.on_meshtastic_mesh_packet(packet_decoded) 35 | 36 | # mock_set_last_rx_time.assert_called_once() 37 | mock_add_packets_total.assert_called_once() 38 | 39 | neighbor_info = json.loads(packet)["decoded"]["neighborinfo"] 40 | for n in neighbor_info["neighbors"]: 41 | mock_set_snr_decibels.assert_called() # TODO: more logic here 42 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "meshtastic-prometheus-exporter" 7 | dynamic = ["version"] 8 | description = '' 9 | readme = "README.md" 10 | requires-python = ">=3.8" 11 | license = "MIT" 12 | keywords = [] 13 | authors = [ 14 | { name = "Artiom Mocrenco", email = "artiom.mocrenco@gmail.com" }, 15 | ] 16 | classifiers = [ 17 | "Development Status :: 4 - Beta", 18 | "Programming Language :: Python :: 3.12", 19 | ] 20 | dependencies = [ 21 | "opentelemetry-api==1.35.0", 22 | "opentelemetry-exporter-prometheus==0.56b0", 23 | "opentelemetry-sdk==1.35.0", 24 | "paho-mqtt==2.1.0", 25 | "cachetools==6.1.0", 26 | "meshtastic==2.7.0", 27 | "Pypubsub==4.0.3", 28 | "sentry-sdk==2.34.1", 29 | ] 30 | 31 | [project.urls] 32 | Documentation = "https://github.com/Artiom Mocrenco/meshtastic-prometheus-exporter#readme" 33 | Issues = "https://github.com/Artiom Mocrenco/meshtastic-prometheus-exporter/issues" 34 | Source = "https://github.com/Artiom Mocrenco/meshtastic-prometheus-exporter" 35 | 36 | [tool.hatch.version] 37 | path = "src/meshtastic_prometheus_exporter/__about__.py" 38 | 39 | [project.scripts] 40 | meshtastic-prometheus-exporter = "meshtastic_prometheus_exporter.__main__:main" 41 | 42 | [tool.coverage.run] 43 | source_pkgs = ["meshtastic_prometheus_exporter", "tests"] 44 | branch = true 45 | parallel = true 46 | omit = [ 47 | "src/meshtastic_prometheus_exporter/__about__.py", 48 | ] 49 | 50 | [tool.coverage.paths] 51 | meshtastic_prometheus_exporter = ["src/meshtastic_prometheus_exporter", "*/meshtastic-prometheus-exporter/src/meshtastic_prometheus_exporter"] 52 | tests = ["tests", "*/meshtastic-prometheus-exporter/tests"] 53 | 54 | [tool.coverage.report] 55 | exclude_lines = [ 56 | "no cov", 57 | "if __name__ == .__main__.:", 58 | "if TYPE_CHECKING:", 59 | ] 60 | 61 | [tool.pytest.ini_options] 62 | pythonpath = [ 63 | ".", "src" 64 | ] 65 | 66 | [tool.hatch.envs.hatch-test.scripts] 67 | run = "pytest{env:HATCH_TEST_ARGS:} {args}" 68 | run-cov = "coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}" 69 | cov-combine = "coverage combine" 70 | cov-report = "coverage html" -------------------------------------------------------------------------------- /SUPPORTED_METRICS.md: -------------------------------------------------------------------------------- 1 | # Supported metrics 2 | 3 | | Name | Type | 4 | |---------------------------------------------------------|---------| 5 | | meshtastic_mesh_packets_total | counter | 6 | | meshtastic_node_info_last_heard_timestamp_seconds | gauge | 7 | | meshtastic_neighbor_info_snr_decibels | gauge | 8 | | meshtastic_neighbor_info_last_rx_time | gauge | 9 | | meshtastic_telemetry_device_battery_level_percent | gauge | 10 | | meshtastic_telemetry_device_voltage_volts | gauge | 11 | | meshtastic_telemetry_device_channel_utilization_percent | gauge | 12 | | meshtastic_telemetry_device_air_util_tx_percent | gauge | 13 | | meshtastic_telemetry_env_temperature_celsius | gauge | 14 | | meshtastic_telemetry_env_relative_humidity_percent | gauge | 15 | | meshtastic_telemetry_env_barometric_pressure_pascal | gauge | 16 | | meshtastic_telemetry_env_gas_resistance_ohms | gauge | 17 | | meshtastic_telemetry_env_voltage_volts | gauge | 18 | | meshtastic_telemetry_env_current_amperes | gauge | 19 | | meshtastic_telemetry_power_ch1_voltage_volts | gauge | 20 | | meshtastic_telemetry_power_ch1_current_amperes | gauge | 21 | | meshtastic_telemetry_power_ch2_voltage_volts | gauge | 22 | | meshtastic_telemetry_power_ch2_current_amperes | gauge | 23 | | meshtastic_telemetry_power_ch3_voltage_volts | gauge | 24 | | meshtastic_telemetry_power_ch3_current_amperes | gauge | 25 | 26 | ## Air quality metrics 27 | 28 | :interrobang: Who knows which units these are, please submit a PR/issue 29 | 30 | | Name | Type | 31 | |------------------------------------------------------|-------| 32 | | meshtastic_telemetry_air_quality_pm10_standard | gauge | 33 | | meshtastic_telemetry_air_quality_pm25_standard | gauge | 34 | | meshtastic_telemetry_air_quality_pm100_standard | gauge | 35 | | meshtastic_telemetry_air_quality_pm10_environmental | gauge | 36 | | meshtastic_telemetry_air_quality_pm25_environmental | gauge | 37 | | meshtastic_telemetry_air_quality_pm100_environmental | gauge | 38 | | meshtastic_telemetry_air_quality_particles_03um | gauge | 39 | | meshtastic_telemetry_air_quality_particles_05um | gauge | 40 | | meshtastic_telemetry_air_quality_particles_10um | gauge | 41 | | meshtastic_telemetry_air_quality_particles_25um | gauge | 42 | | meshtastic_telemetry_air_quality_particles_50um | gauge | 43 | | meshtastic_telemetry_air_quality_particles_100um | gauge | 44 | -------------------------------------------------------------------------------- /tests/test_telemetry.py: -------------------------------------------------------------------------------- 1 | import meshtastic_prometheus_exporter.__main__ as exporter 2 | import json 3 | from pytest_mock import MockerFixture 4 | 5 | 6 | def mocked_get_decoded_node_metadata_from_cache(cache, node: float, metadata: str): 7 | return "mocked" 8 | 9 | 10 | def test_device_metrics_telemetry(mocker: MockerFixture): 11 | packet = '{"from": 123456789, "to": 987654321, "decoded": {"portnum": "TELEMETRY_APP", "telemetry": {"time": 1732550036, "deviceMetrics": {"batteryLevel": 101, "voltage": 4.122, "channelUtilization": 0.0, "airUtilTx": 0.15486111, "uptimeSeconds": 2027}}}, "id": 3259852062, "rxTime": 1732550036, "hopLimit": 3, "priority": "BACKGROUND", "fromId": null, "toId": "^all"}' 12 | 13 | packet_decoded = json.loads(packet) 14 | 15 | mocker.patch( 16 | "meshtastic_prometheus_exporter.__main__.get_decoded_node_metadata_from_cache", 17 | new=mocked_get_decoded_node_metadata_from_cache, 18 | ) 19 | 20 | mock_set_battery_level = mocker.patch.object( 21 | exporter.meshtastic_telemetry_device_battery_level_percent, "set" 22 | ) 23 | mock_set_voltage = mocker.patch.object( 24 | exporter.meshtastic_telemetry_device_voltage_volts, "set" 25 | ) 26 | mock_set_channel_utilization = mocker.patch.object( 27 | exporter.meshtastic_telemetry_device_channel_utilization_percent, "set" 28 | ) 29 | mock_set_air_util = mocker.patch.object( 30 | exporter.meshtastic_telemetry_device_air_util_tx_percent, "set" 31 | ) 32 | mock_add_packets_total = mocker.patch.object( 33 | exporter.meshtastic_mesh_packets_total, "add" 34 | ) 35 | 36 | exporter.on_meshtastic_mesh_packet(packet_decoded) 37 | 38 | mock_set_battery_level.assert_called_once_with( 39 | 101, 40 | attributes={ 41 | "source": packet_decoded["from"], 42 | "source_long_name": "mocked", 43 | "source_short_name": "mocked", 44 | }, 45 | ) 46 | mock_set_voltage.assert_called_once_with( 47 | 4.122, 48 | attributes={ 49 | "source": packet_decoded["from"], 50 | "source_long_name": "mocked", 51 | "source_short_name": "mocked", 52 | }, 53 | ) 54 | mock_set_channel_utilization.assert_called_once_with( 55 | 0.0, 56 | attributes={ 57 | "source": packet_decoded["from"], 58 | "source_long_name": "mocked", 59 | "source_short_name": "mocked", 60 | }, 61 | ) 62 | mock_set_air_util.assert_called_once_with( 63 | 0.15486111, 64 | attributes={ 65 | "source": packet_decoded["from"], 66 | "source_long_name": "mocked", 67 | "source_short_name": "mocked", 68 | }, 69 | ) 70 | mock_add_packets_total.assert_called_once() 71 | -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/metrics.py: -------------------------------------------------------------------------------- 1 | from opentelemetry import metrics 2 | 3 | meter = metrics.get_meter("meshtastic_prometheus_exporter") 4 | 5 | meshtastic_mesh_packets_total = meter.create_counter( 6 | name="meshtastic_mesh_packets_total", 7 | ) 8 | 9 | meshtastic_node_info_last_heard_timestamp_seconds = meter.create_gauge( 10 | name="meshtastic_node_info_last_heard_timestamp_seconds", 11 | ) 12 | 13 | meshtastic_neighbor_info_snr_decibels = meter.create_gauge( 14 | name="meshtastic_neighbor_info_snr_decibels", 15 | ) 16 | 17 | meshtastic_neighbor_info_last_rx_time = meter.create_gauge( 18 | name="meshtastic_neighbor_info_last_rx_time", 19 | ) 20 | 21 | meshtastic_telemetry_device_battery_level_percent = meter.create_gauge( 22 | name="meshtastic_telemetry_device_battery_level_percent", 23 | ) 24 | 25 | meshtastic_telemetry_device_voltage_volts = meter.create_gauge( 26 | name="meshtastic_telemetry_device_voltage_volts", 27 | ) 28 | 29 | meshtastic_telemetry_device_channel_utilization_percent = meter.create_gauge( 30 | name="meshtastic_telemetry_device_channel_utilization_percent", 31 | ) 32 | 33 | meshtastic_telemetry_device_air_util_tx_percent = meter.create_gauge( 34 | name="meshtastic_telemetry_device_air_util_tx_percent", 35 | ) 36 | 37 | meshtastic_telemetry_env_temperature_celsius = meter.create_gauge( 38 | name="meshtastic_telemetry_env_temperature_celsius", 39 | ) 40 | 41 | meshtastic_telemetry_env_relative_humidity_percent = meter.create_gauge( 42 | name="meshtastic_telemetry_env_relative_humidity_percent", 43 | ) 44 | 45 | meshtastic_telemetry_env_barometric_pressure_pascal = meter.create_gauge( 46 | name="meshtastic_telemetry_env_barometric_pressure_pascal", 47 | ) 48 | 49 | meshtastic_telemetry_env_gas_resistance_ohms = meter.create_gauge( 50 | name="meshtastic_telemetry_env_gas_resistance_ohms", 51 | ) 52 | 53 | meshtastic_telemetry_env_voltage_volts = meter.create_gauge( 54 | name="meshtastic_telemetry_env_voltage_volts", 55 | ) 56 | 57 | meshtastic_telemetry_env_current_amperes = meter.create_gauge( 58 | name="meshtastic_telemetry_env_current_amperes", 59 | ) 60 | 61 | meshtastic_telemetry_power_ch1_voltage_volts = meter.create_gauge( 62 | name="meshtastic_telemetry_power_ch1_voltage_volts", 63 | ) 64 | 65 | meshtastic_telemetry_power_ch1_current_amperes = meter.create_gauge( 66 | name="meshtastic_telemetry_power_ch1_current_amperes", 67 | ) 68 | 69 | meshtastic_telemetry_power_ch2_voltage_volts = meter.create_gauge( 70 | name="meshtastic_telemetry_power_ch2_voltage_volts", 71 | ) 72 | 73 | meshtastic_telemetry_power_ch2_current_amperes = meter.create_gauge( 74 | name="meshtastic_telemetry_power_ch2_current_amperes", 75 | ) 76 | 77 | meshtastic_telemetry_power_ch3_voltage_volts = meter.create_gauge( 78 | name="meshtastic_telemetry_power_ch3_voltage_volts", 79 | ) 80 | 81 | meshtastic_telemetry_power_ch3_current_amperes = meter.create_gauge( 82 | name="meshtastic_telemetry_power_ch3_current_amperes", 83 | ) 84 | 85 | meshtastic_telemetry_air_quality_pm10_standard = meter.create_gauge( 86 | name="meshtastic_telemetry_air_quality_pm10_standard", 87 | ) 88 | 89 | meshtastic_telemetry_air_quality_pm25_standard = meter.create_gauge( 90 | name="meshtastic_telemetry_air_quality_pm25_standard", 91 | ) 92 | 93 | meshtastic_telemetry_air_quality_pm100_standard = meter.create_gauge( 94 | name="meshtastic_telemetry_air_quality_pm100_standard", 95 | ) 96 | 97 | meshtastic_telemetry_air_quality_pm10_environmental = meter.create_gauge( 98 | name="meshtastic_telemetry_air_quality_pm10_environmental", 99 | ) 100 | 101 | meshtastic_telemetry_air_quality_pm25_environmental = meter.create_gauge( 102 | name="meshtastic_telemetry_air_quality_pm25_environmental", 103 | ) 104 | 105 | meshtastic_telemetry_air_quality_pm100_environmental = meter.create_gauge( 106 | name="meshtastic_telemetry_air_quality_pm100_environmental", 107 | ) 108 | 109 | meshtastic_telemetry_air_quality_particles_03um = meter.create_gauge( 110 | name="meshtastic_telemetry_air_quality_particles_03um", 111 | ) 112 | 113 | meshtastic_telemetry_air_quality_particles_05um = meter.create_gauge( 114 | name="meshtastic_telemetry_air_quality_particles_05um", 115 | ) 116 | 117 | meshtastic_telemetry_air_quality_particles_10um = meter.create_gauge( 118 | name="meshtastic_telemetry_air_quality_particles_10um", 119 | ) 120 | 121 | meshtastic_telemetry_air_quality_particles_25um = meter.create_gauge( 122 | name="meshtastic_telemetry_air_quality_particles_25um", 123 | ) 124 | 125 | meshtastic_telemetry_air_quality_particles_50um = meter.create_gauge( 126 | name="meshtastic_telemetry_air_quality_particles_50um", 127 | ) 128 | 129 | meshtastic_telemetry_air_quality_particles_100um = meter.create_gauge( 130 | name="meshtastic_telemetry_air_quality_particles_100um", 131 | ) 132 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # meshtastic-prometheus-exporter 2 | 3 | ![meshtasticexporter](https://github.com/artiommocrenco/meshtastic-prometheus-exporter/assets/28516476/162a2fab-5804-46d0-a97a-aa84e388ef58) 4 | 5 | Meshtastic Prometheus Exporter captures and parses every MeshPacket from your Meshtastic network, exposing detailed metrics about the packets. It supports data collection via MQTT, BLE, Serial, or TCP, and makes these metrics available to Prometheus. It comes with grafana dashboards that help visualize network performance, node status, and telemetry for real-time or historical monitoring. 6 | 7 | ## Supported metrics 8 | 9 | See [SUPPORTED_METRICS.md](SUPPORTED_METRICS.md) for a list of supported metrics 10 | 11 | ## Usage 12 | 13 | ### Use with MQTT 14 | 15 | 1. Find an MQTT server you want to use or use the public Meshtastic MQTT server (`mqtt.meshtastic.org`). 16 | 2. For your Meshtastic node, [configure and enable MQTT module](https://meshtastic.org/docs/configuration/module/mqtt/) for uplink. 17 | 3. Clone the repo, or download (preferably) [latest release](https://github.com/artiommocrenco/meshtastic-prometheus-exporter/releases/latest), uncompress it and navigate to the directory with the `docker-compose.yml` file. 18 | 4. Edit the `docker-compose.yml` file and specify connection details to the MQTT server there too. 19 | 5. In your terminal, run `docker-compose up` (for this, you need Docker installed). 20 | 21 | ### Use with BLE (Bluetooth Low Energy) 22 | 23 | You can connect to your Meshtastic device via BLE, which is useful if you don't want to use MQTT, Serial, or TCP. This method is tested on Linux (outside Docker), but may work on other platforms as well. 24 | 25 | #### Pair your device 26 | 27 | Open a terminal and use `bluetoothctl` to pair with your Meshtastic device: 28 | 29 | ```bash 30 | bluetoothctl 31 | [bluetooth]# power on 32 | [bluetooth]# scan on 33 | [bluetooth]# pair AA:BB:CC:DD:EE:FF 34 | # Follow prompts to enter the passkey if requested 35 | [bluetooth]# disconnect AA:BB:CC:DD:EE:FF 36 | ``` 37 | 38 | - Replace `AA:BB:CC:DD:EE:FF` with your device's MAC address (find it by name while scanning). 39 | - Make sure to **disconnect** after pairing. The exporter (and the Meshtastic CLI) need to manage the connection themselves. 40 | 41 | #### Test with Meshtastic CLI 42 | 43 | Verify BLE connectivity with the Meshtastic CLI: 44 | 45 | ```bash 46 | meshtastic -b AA:BB:CC:DD:EE:FF --nodes 47 | ``` 48 | 49 | If this works, you’re ready to use the exporter. 50 | 51 | #### Run the exporter 52 | 53 | Set the required environment variables and run the exporter: 54 | 55 | ```bash 56 | MESHTASTIC_INTERFACE=BLE INTERFACE_BLE_ADDR=AA:BB:CC:DD:EE:FF meshtastic-prometheus-exporter 57 | ``` 58 | 59 | ### Use with Serial 60 | 61 | 1. Connect your Meshtastic device to your computer via a serial interface (e.g., USB). 62 | 2. Clone the repo, or download (preferably) [latest release](https://github.com/artiommocrenco/meshtastic-prometheus-exporter/releases/latest), uncompress it and navigate to the directory with the `docker-compose.yml` file. 63 | 3. Edit the `docker-compose.yml` file and set `MESHTASTIC_INTERFACE` to `SERIAL` and optionally specify the serial device path. 64 | 4. In your terminal, run `docker-compose up` (for this, you need Docker installed). 65 | 66 | ### Use with TCP 67 | 68 | 1. Ensure your Meshtastic device is accessible over a TCP interface. 69 | 2. Clone the repo, or download (preferably) [latest release](https://github.com/artiommocrenco/meshtastic-prometheus-exporter/releases/latest), uncompress it and navigate to the directory with the `docker-compose.yml` file. 70 | 3. Edit the `docker-compose.yml` file and set `MESHTASTIC_INTERFACE` to `TCP` and specify the TCP address and port of your device. 71 | 4. In your terminal, run `docker-compose up` (for this, you need Docker installed). 72 | 73 | ## Accessing Grafana 74 | 75 | In your web browser, navigate to http://localhost:3000/dashboards and authenticate using default Grafana credentials (username `admin`, password `admin`). 76 | 77 | ## Installation using pipx 78 | 79 | If you prefer to install the exporter using `pipx`, you can do so by running the following command: 80 | 81 | ```bash 82 | pipx install meshtastic-prometheus-exporter 83 | ``` 84 | 85 | You could then run it outside docker, and configure Prometheus to scrape it: 86 | 87 | ```yaml 88 | global: 89 | scrape_interval: 15s 90 | evaluation_interval: 15s 91 | scrape_configs: 92 | - job_name: "meshtastic" 93 | static_configs: 94 | - targets: ["host.docker.internal:9464"] 95 | ``` 96 | 97 | ## Installation using helm 98 | 99 | Coming soon. 100 | 101 | ## Known limitations 102 | 103 | * Running two exporters for the same meshtastic network that write to the same Prometheus is not supported 104 | * While mostly reporting useful information, Grafana dashboards do contain mistakes in some of the visualizations 105 | * Using TLS for MQTT on meshtastic side may be problematic for performance and reliability (third-party issue) 106 | * Exception handling & code quality need improvement 107 | 108 | ## Contributing 109 | 110 | Please feel free to contribute 111 | -------------------------------------------------------------------------------- /grafana-dashboards/neighbor-info-net.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "Prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "grafana", 16 | "id": "grafana", 17 | "name": "Grafana", 18 | "version": "10.4.2" 19 | }, 20 | { 21 | "type": "datasource", 22 | "id": "prometheus", 23 | "name": "Prometheus", 24 | "version": "1.0.0" 25 | }, 26 | { 27 | "type": "panel", 28 | "id": "timeseries", 29 | "name": "Time series", 30 | "version": "" 31 | } 32 | ], 33 | "annotations": { 34 | "list": [ 35 | { 36 | "builtIn": 1, 37 | "datasource": { 38 | "type": "grafana", 39 | "uid": "-- Grafana --" 40 | }, 41 | "enable": true, 42 | "hide": true, 43 | "iconColor": "rgba(0, 211, 255, 1)", 44 | "name": "Annotations & Alerts", 45 | "type": "dashboard" 46 | } 47 | ] 48 | }, 49 | "editable": true, 50 | "fiscalYearStartMonth": 0, 51 | "graphTooltip": 0, 52 | "id": null, 53 | "links": [], 54 | "liveNow": false, 55 | "panels": [ 56 | { 57 | "datasource": { 58 | "type": "prometheus", 59 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 60 | }, 61 | "fieldConfig": { 62 | "defaults": { 63 | "color": { 64 | "mode": "thresholds", 65 | "seriesBy": "last" 66 | }, 67 | "custom": { 68 | "axisBorderShow": true, 69 | "axisCenteredZero": false, 70 | "axisColorMode": "text", 71 | "axisLabel": "", 72 | "axisPlacement": "auto", 73 | "barAlignment": 0, 74 | "drawStyle": "line", 75 | "fillOpacity": 0, 76 | "gradientMode": "scheme", 77 | "hideFrom": { 78 | "legend": false, 79 | "tooltip": false, 80 | "viz": false 81 | }, 82 | "insertNulls": false, 83 | "lineInterpolation": "linear", 84 | "lineWidth": 1, 85 | "pointSize": 5, 86 | "scaleDistribution": { 87 | "log": 10, 88 | "type": "symlog" 89 | }, 90 | "showPoints": "always", 91 | "spanNulls": true, 92 | "stacking": { 93 | "group": "A", 94 | "mode": "none" 95 | }, 96 | "thresholdsStyle": { 97 | "mode": "off" 98 | } 99 | }, 100 | "decimals": 2, 101 | "mappings": [], 102 | "max": 20, 103 | "min": -20, 104 | "thresholds": { 105 | "mode": "absolute", 106 | "steps": [ 107 | { 108 | "color": "dark-red", 109 | "value": null 110 | }, 111 | { 112 | "color": "dark-yellow", 113 | "value": -10 114 | }, 115 | { 116 | "color": "dark-green", 117 | "value": 0 118 | } 119 | ] 120 | }, 121 | "unit": "dB" 122 | }, 123 | "overrides": [] 124 | }, 125 | "gridPos": { 126 | "h": 24, 127 | "w": 24, 128 | "x": 0, 129 | "y": 0 130 | }, 131 | "id": 1, 132 | "options": { 133 | "legend": { 134 | "calcs": [ 135 | "lastNotNull", 136 | "min", 137 | "max" 138 | ], 139 | "displayMode": "table", 140 | "placement": "bottom", 141 | "showLegend": true, 142 | "sortBy": "Last *", 143 | "sortDesc": true 144 | }, 145 | "tooltip": { 146 | "mode": "single", 147 | "sort": "none" 148 | } 149 | }, 150 | "targets": [ 151 | { 152 | "datasource": { 153 | "type": "prometheus", 154 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 155 | }, 156 | "disableTextWrap": false, 157 | "editorMode": "builder", 158 | "expr": "avg_over_time(meshtastic_neighbor_info_snr_decibels[$__interval])", 159 | "fullMetaSearch": false, 160 | "includeNullMetadata": true, 161 | "instant": false, 162 | "interval": "1m", 163 | "legendFormat": "{{source_long_name}} ({{source}}) <- {{neighbor_source_long_name}} ({{neighbor_source}})", 164 | "range": true, 165 | "refId": "A", 166 | "useBackend": false 167 | } 168 | ], 169 | "title": "SNR per source, neighbor", 170 | "type": "timeseries" 171 | } 172 | ], 173 | "refresh": "1m", 174 | "schemaVersion": 39, 175 | "tags": [], 176 | "templating": { 177 | "list": [] 178 | }, 179 | "time": { 180 | "from": "now-6h", 181 | "to": "now" 182 | }, 183 | "timepicker": {}, 184 | "timezone": "", 185 | "title": "Meshtastic Neighbor Info (Net)", 186 | "uid": "a8711380-ea8b-43d3-931a-e7233e8189f0", 187 | "version": 1, 188 | "weekStart": "" 189 | } -------------------------------------------------------------------------------- /.github/workflows/trunk.yml: -------------------------------------------------------------------------------- 1 | name: trunk 2 | 3 | on: 4 | push: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | 9 | test: 10 | name: Run tests 11 | runs-on: ubuntu-latest 12 | outputs: 13 | version-changed: ${{ steps.changes.outputs.version }} 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: psf/black@stable 17 | - name: Set up Python 18 | uses: actions/setup-python@v5 19 | with: 20 | python-version: "3.12" 21 | cache: 'pip' 22 | - name: Install hatch 23 | run: >- 24 | python3 -m 25 | pip install 26 | hatch 27 | - name: Run tests 28 | run: hatch test 29 | - uses: dorny/paths-filter@v3 30 | id: changes 31 | with: 32 | filters: | 33 | version: 34 | - 'src/meshtastic_prometheus_exporter/__about__.py' 35 | 36 | build: 37 | name: Build Python Wheel 📦 38 | runs-on: ubuntu-latest 39 | if: github.ref == 'refs/heads/main' && needs.test.outputs.version-changed == 'true' 40 | needs: 41 | - test 42 | outputs: 43 | our-version-major: ${{ steps.our-version-major.outputs.version }} 44 | our-version-minor: ${{ steps.our-version-minor.outputs.version }} 45 | our-version-full: ${{ steps.our-version-full.outputs.version }} 46 | steps: 47 | - uses: actions/checkout@v4 48 | - id: our-version-major 49 | run: | 50 | echo version=$(grep -oP '(?<=__version__ = ")[^"]*' src/meshtastic_prometheus_exporter/__about__.py | cut -d '.' -f 1) >> $GITHUB_OUTPUT 51 | - id: our-version-minor 52 | run: | 53 | echo version=$(grep -oP '(?<=__version__ = ")[^"]*' src/meshtastic_prometheus_exporter/__about__.py | cut -d '.' -f 2) >> $GITHUB_OUTPUT 54 | - id: our-version-full 55 | run: | 56 | echo version=$(grep -oP '(?<=__version__ = ")[^"]*' src/meshtastic_prometheus_exporter/__about__.py) >> $GITHUB_OUTPUT 57 | - name: Set up Python 58 | uses: actions/setup-python@v5 59 | with: 60 | python-version: "3.12" 61 | cache: 'pip' 62 | - name: Install hatch 63 | run: >- 64 | python3 -m 65 | pip install 66 | hatch 67 | - name: Build a binary wheel and a source tarball 68 | run: hatch build 69 | - name: Store the distribution packages 70 | uses: actions/upload-artifact@v4 71 | with: 72 | name: python-package-distributions 73 | path: dist/ 74 | 75 | build-and-push-image: 76 | name: Build and push container image to GHCR 77 | runs-on: ubuntu-latest 78 | if: github.ref == 'refs/heads/main' && needs.test.outputs.version-changed == 'true' 79 | needs: 80 | - test 81 | - build 82 | permissions: 83 | contents: read 84 | packages: write 85 | steps: 86 | - name: Checkout 87 | uses: actions/checkout@v4 88 | 89 | - name: Download all the dists 90 | uses: actions/download-artifact@v4 91 | with: 92 | name: python-package-distributions 93 | path: dist/ 94 | 95 | - name: Set up QEMU 96 | uses: docker/setup-qemu-action@v3 97 | 98 | - name: Set up Docker Buildx 99 | uses: docker/setup-buildx-action@v3 100 | 101 | - name: Login to GitHub Container Registry 102 | uses: docker/login-action@v3 103 | with: 104 | registry: ghcr.io 105 | username: ${{ github.actor }} 106 | password: ${{ secrets.GITHUB_TOKEN }} 107 | 108 | - name: Build and push 109 | uses: docker/build-push-action@v6 110 | with: 111 | file: Dockerfile 112 | context: . 113 | push: true 114 | platforms: linux/amd64,linux/arm64,linux/arm/v7 115 | tags: | 116 | ghcr.io/hacktegic/meshtastic-prometheus-exporter:${{ needs.build.outputs.our-version-full }} 117 | ghcr.io/hacktegic/meshtastic-prometheus-exporter:${{ needs.build.outputs.our-version-major }} 118 | ghcr.io/hacktegic/meshtastic-prometheus-exporter:latest 119 | 120 | publish-to-pypi: 121 | name: >- 122 | Publish 📦 to PyPI 123 | if: github.ref == 'refs/heads/main' && needs.test.outputs.version-changed == 'true' 124 | needs: 125 | - test 126 | - build 127 | runs-on: ubuntu-latest 128 | environment: 129 | name: pypi 130 | url: https://pypi.org/p/meshtastic-prometheus-exporter 131 | permissions: 132 | id-token: write # IMPORTANT: mandatory for trusted publishing 133 | steps: 134 | - name: Download all the dists 135 | uses: actions/download-artifact@v4 136 | with: 137 | name: python-package-distributions 138 | path: dist/ 139 | - name: Publish distribution 📦 to PyPI 140 | uses: pypa/gh-action-pypi-publish@release/v1 141 | with: 142 | packages-dir: dist/ 143 | verbose: true 144 | 145 | release: 146 | name: >- 147 | Create GitHub Release 148 | if: github.ref == 'refs/heads/main' && needs.test.outputs.version-changed == 'true' 149 | permissions: 150 | contents: write 151 | runs-on: ubuntu-latest 152 | needs: 153 | - build 154 | - build-and-push-image 155 | steps: 156 | - name: Checkout 157 | uses: actions/checkout@v4 158 | with: 159 | fetch-depth: '0' 160 | - name: Bump version and push tag 161 | uses: anothrNick/github-tag-action@1.73.0 162 | env: 163 | CUSTOM_TAG: ${{ needs.build.outputs.our-version-full }} 164 | GITHUB_TOKEN: ${{ github.token }} 165 | - name: Release 166 | uses: softprops/action-gh-release@v2 167 | with: 168 | draft: true 169 | prerelease: true 170 | name: ${{ needs.build.outputs.our-version-full }} 171 | tag_name: ${{ needs.build.outputs.our-version-full }} 172 | generate_release_notes: true 173 | token: ${{ github.token }} 174 | -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/telemetry.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import json 3 | from meshtastic_prometheus_exporter.metrics import * 4 | from meshtastic_prometheus_exporter.util import get_decoded_node_metadata_from_cache 5 | 6 | logger = logging.getLogger("meshtastic_prometheus_exporter") 7 | 8 | 9 | def on_device_metrics_telemetry(packet, attributes): 10 | logger.info(f"MeshPacket {packet['id']} is device metrics telemetry") 11 | if "batteryLevel" in packet["decoded"]["telemetry"]["deviceMetrics"]: 12 | meshtastic_telemetry_device_battery_level_percent.set( 13 | packet["decoded"]["telemetry"]["deviceMetrics"]["batteryLevel"], 14 | attributes=attributes, 15 | ) 16 | if "voltage" in packet["decoded"]["telemetry"]["deviceMetrics"]: 17 | meshtastic_telemetry_device_voltage_volts.set( 18 | packet["decoded"]["telemetry"]["deviceMetrics"]["voltage"], 19 | attributes=attributes, 20 | ) 21 | if "channelUtilization" in packet["decoded"]["telemetry"]["deviceMetrics"]: 22 | meshtastic_telemetry_device_channel_utilization_percent.set( 23 | packet["decoded"]["telemetry"]["deviceMetrics"]["channelUtilization"], 24 | attributes=attributes, 25 | ) 26 | if "airUtilTx" in packet["decoded"]["telemetry"]["deviceMetrics"]: 27 | meshtastic_telemetry_device_air_util_tx_percent.set( 28 | packet["decoded"]["telemetry"]["deviceMetrics"]["airUtilTx"], 29 | attributes=attributes, 30 | ) 31 | 32 | 33 | def on_meshtastic_telemetry_app(packet, source_long_name, source_short_name): 34 | telemetry = packet["decoded"]["telemetry"] 35 | logger.debug( 36 | f"Received MeshPacket {packet['id']} with Telemetry `{json.dumps(telemetry, default=repr)}`" 37 | ) 38 | source = packet["decoded"].get("source", packet["from"]) 39 | telemetry_attributes = { 40 | "source": source or "unknown", 41 | "source_long_name": source_long_name or "unknown", 42 | "source_short_name": source_short_name or "unknown", 43 | } 44 | if "deviceMetrics" in telemetry: 45 | on_device_metrics_telemetry(packet, telemetry_attributes) 46 | return 47 | 48 | if "environmentMetrics" in telemetry: 49 | logger.info(f"MeshPacket {packet['id']} is environment metrics telemetry") 50 | if "temperature" in telemetry["environmentMetrics"]: 51 | meshtastic_telemetry_env_temperature_celsius.set( 52 | telemetry["environmentMetrics"]["temperature"], 53 | attributes=telemetry_attributes, 54 | ) 55 | if "relativeHumidity" in telemetry["environmentMetrics"]: 56 | meshtastic_telemetry_env_relative_humidity_percent.set( 57 | telemetry["environmentMetrics"]["relativeHumidity"], 58 | attributes=telemetry_attributes, 59 | ) 60 | if "barometricPressure" in telemetry["environmentMetrics"]: 61 | meshtastic_telemetry_env_barometric_pressure_pascal.set( 62 | telemetry["environmentMetrics"]["barometricPressure"] * 10**2, 63 | attributes=telemetry_attributes, 64 | ) 65 | if "gasResistance" in telemetry["environmentMetrics"]: 66 | meshtastic_telemetry_env_gas_resistance_ohms.set( 67 | telemetry["environmentMetrics"]["gasResistance"] / 10**6, 68 | attributes=telemetry_attributes, 69 | ) 70 | if "voltage" in telemetry["environmentMetrics"]: 71 | meshtastic_telemetry_env_voltage_volts.set( 72 | telemetry["environmentMetrics"]["voltage"], 73 | attributes=telemetry_attributes, 74 | ) 75 | if "current" in telemetry["environmentMetrics"]: 76 | meshtastic_telemetry_env_current_amperes.set( 77 | telemetry["environmentMetrics"]["current"] * 10**-3, 78 | attributes=telemetry_attributes, 79 | ) 80 | if "airQualityMetrics" in telemetry: 81 | logger.info(f"MeshPacket {packet['id']} is air quality metrics telemetry") 82 | meshtastic_telemetry_air_quality_pm10_standard.set( 83 | telemetry["airQualityMetrics"]["pm10_standard"], 84 | attributes=telemetry_attributes, 85 | ) 86 | meshtastic_telemetry_air_quality_pm25_standard.set( 87 | telemetry["airQualityMetrics"]["pm25_standard"], 88 | attributes=telemetry_attributes, 89 | ) 90 | meshtastic_telemetry_air_quality_pm100_standard.set( 91 | telemetry["airQualityMetrics"]["pm100_standard"], 92 | attributes=telemetry_attributes, 93 | ) 94 | meshtastic_telemetry_air_quality_pm10_environmental.set( 95 | telemetry["airQualityMetrics"]["pm10_environmental"], 96 | attributes=telemetry_attributes, 97 | ) 98 | meshtastic_telemetry_air_quality_pm25_environmental.set( 99 | telemetry["airQualityMetrics"]["pm25_environmental"], 100 | attributes=telemetry_attributes, 101 | ) 102 | meshtastic_telemetry_air_quality_pm100_environmental.set( 103 | telemetry["airQualityMetrics"]["pm100_environmental"], 104 | attributes=telemetry_attributes, 105 | ) 106 | meshtastic_telemetry_air_quality_particles_03um.set( 107 | telemetry["airQualityMetrics"]["particles_03um"], 108 | attributes=telemetry_attributes, 109 | ) 110 | meshtastic_telemetry_air_quality_particles_05um.set( 111 | telemetry["airQualityMetrics"]["particles_05um"], 112 | attributes=telemetry_attributes, 113 | ) 114 | meshtastic_telemetry_air_quality_particles_10um.set( 115 | telemetry["airQualityMetrics"]["particles_10um"], 116 | attributes=telemetry_attributes, 117 | ) 118 | meshtastic_telemetry_air_quality_particles_25um.set( 119 | telemetry["airQualityMetrics"]["particles_25um"], 120 | attributes=telemetry_attributes, 121 | ) 122 | meshtastic_telemetry_air_quality_particles_50um.set( 123 | telemetry["airQualityMetrics"]["particles_50um"], 124 | attributes=telemetry_attributes, 125 | ) 126 | meshtastic_telemetry_air_quality_particles_100um.set( 127 | telemetry["airQualityMetrics"]["particles_100um"], 128 | attributes=telemetry_attributes, 129 | ) 130 | if "powerMetrics" in telemetry: 131 | logger.info(f"MeshPacket {packet['id']} is power metrics telemetry") 132 | meshtastic_telemetry_power_ch1_voltage_volts.set( 133 | telemetry["powerMetrics"]["ch1_voltage"], 134 | attributes=telemetry_attributes, 135 | ) 136 | meshtastic_telemetry_power_ch1_current_amperes.set( 137 | telemetry["powerMetrics"]["ch1_current"] * 10**-3, 138 | attributes=telemetry_attributes, 139 | ) 140 | meshtastic_telemetry_power_ch2_voltage_volts.set( 141 | telemetry["powerMetrics"]["ch2_voltage"], 142 | attributes=telemetry_attributes, 143 | ) 144 | meshtastic_telemetry_power_ch2_current_amperes.set( 145 | telemetry["powerMetrics"]["ch2_current"] * 10**-3, 146 | attributes=telemetry_attributes, 147 | ) 148 | meshtastic_telemetry_power_ch3_voltage_volts.set( 149 | telemetry["powerMetrics"]["ch3_voltage"], 150 | attributes=telemetry_attributes, 151 | ) 152 | meshtastic_telemetry_power_ch3_current_amperes.set( 153 | telemetry["powerMetrics"]["ch3_current"] * 10**-3, 154 | attributes=telemetry_attributes, 155 | ) 156 | -------------------------------------------------------------------------------- /grafana-dashboards/neighbor-info-nodes.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "Prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "grafana", 16 | "id": "grafana", 17 | "name": "Grafana", 18 | "version": "10.4.2" 19 | }, 20 | { 21 | "type": "datasource", 22 | "id": "prometheus", 23 | "name": "Prometheus", 24 | "version": "1.0.0" 25 | }, 26 | { 27 | "type": "panel", 28 | "id": "text", 29 | "name": "Text", 30 | "version": "" 31 | }, 32 | { 33 | "type": "panel", 34 | "id": "timeseries", 35 | "name": "Time series", 36 | "version": "" 37 | } 38 | ], 39 | "annotations": { 40 | "list": [ 41 | { 42 | "builtIn": 1, 43 | "datasource": { 44 | "type": "grafana", 45 | "uid": "-- Grafana --" 46 | }, 47 | "enable": true, 48 | "hide": true, 49 | "iconColor": "rgba(0, 211, 255, 1)", 50 | "name": "Annotations & Alerts", 51 | "type": "dashboard" 52 | } 53 | ] 54 | }, 55 | "editable": true, 56 | "fiscalYearStartMonth": 0, 57 | "graphTooltip": 0, 58 | "id": null, 59 | "links": [], 60 | "liveNow": false, 61 | "panels": [ 62 | { 63 | "datasource": { 64 | "type": "datasource", 65 | "uid": "grafana" 66 | }, 67 | "gridPos": { 68 | "h": 2, 69 | "w": 24, 70 | "x": 0, 71 | "y": 0 72 | }, 73 | "id": 3, 74 | "options": { 75 | "code": { 76 | "language": "plaintext", 77 | "showLineNumbers": false, 78 | "showMiniMap": false 79 | }, 80 | "content": "# Only nodes that have enabled the [Neighbor Info Module](https://meshtastic.org/docs/configuration/module/neighbor-info/) are shown.", 81 | "mode": "markdown" 82 | }, 83 | "pluginVersion": "10.4.2", 84 | "type": "text" 85 | }, 86 | { 87 | "datasource": { 88 | "type": "prometheus", 89 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 90 | }, 91 | "fieldConfig": { 92 | "defaults": { 93 | "color": { 94 | "mode": "thresholds", 95 | "seriesBy": "last" 96 | }, 97 | "custom": { 98 | "axisBorderShow": true, 99 | "axisCenteredZero": false, 100 | "axisColorMode": "text", 101 | "axisLabel": "", 102 | "axisPlacement": "auto", 103 | "barAlignment": 0, 104 | "drawStyle": "line", 105 | "fillOpacity": 0, 106 | "gradientMode": "scheme", 107 | "hideFrom": { 108 | "legend": false, 109 | "tooltip": false, 110 | "viz": false 111 | }, 112 | "insertNulls": false, 113 | "lineInterpolation": "linear", 114 | "lineWidth": 1, 115 | "pointSize": 5, 116 | "scaleDistribution": { 117 | "log": 10, 118 | "type": "symlog" 119 | }, 120 | "showPoints": "always", 121 | "spanNulls": true, 122 | "stacking": { 123 | "group": "A", 124 | "mode": "none" 125 | }, 126 | "thresholdsStyle": { 127 | "mode": "off" 128 | } 129 | }, 130 | "decimals": 2, 131 | "mappings": [], 132 | "max": 20, 133 | "min": -20, 134 | "thresholds": { 135 | "mode": "absolute", 136 | "steps": [ 137 | { 138 | "color": "dark-red", 139 | "value": null 140 | }, 141 | { 142 | "color": "dark-yellow", 143 | "value": -10 144 | }, 145 | { 146 | "color": "dark-green", 147 | "value": 0 148 | } 149 | ] 150 | }, 151 | "unit": "dB" 152 | }, 153 | "overrides": [] 154 | }, 155 | "gridPos": { 156 | "h": 11, 157 | "w": 24, 158 | "x": 0, 159 | "y": 2 160 | }, 161 | "id": 1, 162 | "options": { 163 | "legend": { 164 | "calcs": [ 165 | "lastNotNull", 166 | "min", 167 | "max" 168 | ], 169 | "displayMode": "table", 170 | "placement": "bottom", 171 | "showLegend": true, 172 | "sortBy": "Last *", 173 | "sortDesc": true 174 | }, 175 | "tooltip": { 176 | "mode": "single", 177 | "sort": "none" 178 | } 179 | }, 180 | "targets": [ 181 | { 182 | "datasource": { 183 | "type": "prometheus", 184 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 185 | }, 186 | "disableTextWrap": false, 187 | "editorMode": "builder", 188 | "expr": "avg_over_time(meshtastic_neighbor_info_snr_decibels{source_long_name=~\"$source\"}[$__interval])", 189 | "fullMetaSearch": false, 190 | "includeNullMetadata": true, 191 | "instant": false, 192 | "interval": "1m", 193 | "legendFormat": "{{source_long_name}} ({{source}}) <- {{neighbor_source_long_name}} ({{neighbor_source}})", 194 | "range": true, 195 | "refId": "A", 196 | "useBackend": false 197 | } 198 | ], 199 | "title": "SNR per neighbor (our RX)", 200 | "type": "timeseries" 201 | }, 202 | { 203 | "datasource": { 204 | "type": "prometheus", 205 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 206 | }, 207 | "fieldConfig": { 208 | "defaults": { 209 | "color": { 210 | "mode": "thresholds", 211 | "seriesBy": "last" 212 | }, 213 | "custom": { 214 | "axisBorderShow": true, 215 | "axisCenteredZero": false, 216 | "axisColorMode": "text", 217 | "axisLabel": "", 218 | "axisPlacement": "auto", 219 | "barAlignment": 0, 220 | "drawStyle": "line", 221 | "fillOpacity": 0, 222 | "gradientMode": "scheme", 223 | "hideFrom": { 224 | "legend": false, 225 | "tooltip": false, 226 | "viz": false 227 | }, 228 | "insertNulls": false, 229 | "lineInterpolation": "linear", 230 | "lineWidth": 1, 231 | "pointSize": 5, 232 | "scaleDistribution": { 233 | "log": 10, 234 | "type": "symlog" 235 | }, 236 | "showPoints": "always", 237 | "spanNulls": true, 238 | "stacking": { 239 | "group": "A", 240 | "mode": "none" 241 | }, 242 | "thresholdsStyle": { 243 | "mode": "off" 244 | } 245 | }, 246 | "decimals": 2, 247 | "mappings": [], 248 | "max": 20, 249 | "min": -20, 250 | "thresholds": { 251 | "mode": "absolute", 252 | "steps": [ 253 | { 254 | "color": "dark-red", 255 | "value": null 256 | }, 257 | { 258 | "color": "dark-yellow", 259 | "value": -10 260 | }, 261 | { 262 | "color": "dark-green", 263 | "value": 0 264 | } 265 | ] 266 | }, 267 | "unit": "dB" 268 | }, 269 | "overrides": [] 270 | }, 271 | "gridPos": { 272 | "h": 11, 273 | "w": 24, 274 | "x": 0, 275 | "y": 13 276 | }, 277 | "id": 2, 278 | "options": { 279 | "legend": { 280 | "calcs": [ 281 | "lastNotNull", 282 | "min", 283 | "max" 284 | ], 285 | "displayMode": "table", 286 | "placement": "bottom", 287 | "showLegend": true, 288 | "sortBy": "Last *", 289 | "sortDesc": true 290 | }, 291 | "tooltip": { 292 | "mode": "single", 293 | "sort": "none" 294 | } 295 | }, 296 | "targets": [ 297 | { 298 | "datasource": { 299 | "type": "prometheus", 300 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 301 | }, 302 | "disableTextWrap": false, 303 | "editorMode": "builder", 304 | "expr": "avg_over_time(meshtastic_neighbor_info_snr_decibels{neighbor_source_long_name=~\"$source\"}[$__interval])", 305 | "fullMetaSearch": false, 306 | "includeNullMetadata": true, 307 | "instant": false, 308 | "interval": "1m", 309 | "legendFormat": "{{source_long_name}} ({{source}}) <- {{neighbor_source_long_name}} ({{neighbor_source}})", 310 | "range": true, 311 | "refId": "A", 312 | "useBackend": false 313 | } 314 | ], 315 | "title": "SNR as reported by neighbors (our TX)", 316 | "type": "timeseries" 317 | } 318 | ], 319 | "refresh": "1m", 320 | "schemaVersion": 39, 321 | "tags": [], 322 | "templating": { 323 | "list": [ 324 | { 325 | "current": {}, 326 | "datasource": { 327 | "type": "prometheus", 328 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 329 | }, 330 | "definition": "label_values(meshtastic_mesh_packets_total,source_long_name)", 331 | "hide": 0, 332 | "includeAll": false, 333 | "multi": true, 334 | "name": "source", 335 | "options": [], 336 | "query": { 337 | "qryType": 1, 338 | "query": "label_values(meshtastic_mesh_packets_total,source_long_name)", 339 | "refId": "PrometheusVariableQueryEditor-VariableQuery" 340 | }, 341 | "refresh": 1, 342 | "regex": "", 343 | "skipUrlSync": false, 344 | "sort": 5, 345 | "type": "query" 346 | } 347 | ] 348 | }, 349 | "time": { 350 | "from": "now-6h", 351 | "to": "now" 352 | }, 353 | "timepicker": {}, 354 | "timezone": "", 355 | "title": "Meshtastic Neighbor Info (Nodes)", 356 | "uid": "a8711380-ea8b-43d3-931a-e7233e8189f1", 357 | "version": 5, 358 | "weekStart": "" 359 | } -------------------------------------------------------------------------------- /src/meshtastic_prometheus_exporter/__main__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | """ 4 | meshtastic-prometheus-exporter 5 | Copyright (C) 2024 Artiom Mocrenco and Contributors 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU Affero General Public License as 9 | published by the Free Software Foundation, either version 3 of the 10 | License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU Affero General Public License for more details. 16 | 17 | You should have received a copy of the GNU Affero General Public License 18 | along with this program. If not, see . 19 | """ 20 | import json 21 | import logging 22 | import os 23 | import ssl 24 | import sys 25 | import time 26 | import traceback 27 | from sys import stdout 28 | from google.protobuf.json_format import MessageToDict 29 | 30 | import google.protobuf.message 31 | import meshtastic.ble_interface 32 | import meshtastic.serial_interface 33 | import meshtastic.tcp_interface 34 | from cachetools import TTLCache 35 | from google.protobuf.json_format import MessageToDict 36 | from opentelemetry.exporter.prometheus import PrometheusMetricReader 37 | from opentelemetry.sdk.metrics import MeterProvider 38 | from opentelemetry.sdk.resources import Resource 39 | import paho.mqtt.client as mqtt 40 | from meshtastic.protobuf import mqtt_pb2 41 | from prometheus_client import start_http_server 42 | from pubsub import pub 43 | 44 | from meshtastic_prometheus_exporter.metrics import * 45 | from meshtastic_prometheus_exporter.neighborinfo import on_meshtastic_neighborinfo_app 46 | from meshtastic_prometheus_exporter.nodeinfo import on_meshtastic_nodeinfo_app 47 | from meshtastic_prometheus_exporter.telemetry import on_meshtastic_telemetry_app 48 | from meshtastic_prometheus_exporter.util import ( 49 | get_decoded_node_metadata_from_cache, 50 | save_node_metadata_in_cache, 51 | ) 52 | 53 | 54 | class ColorFormatter(logging.Formatter): 55 | COLORS = { 56 | "DEBUG": "\033[36m", # Cyan 57 | "INFO": "\033[32m", # Green 58 | "WARNING": "\033[33m", # Yellow 59 | "ERROR": "\033[31m", # Red 60 | "FATAL": "\033[41m", # Red background 61 | "CRITICAL": "\033[41m", # Red background 62 | "RESET": "\033[0m", 63 | } 64 | 65 | def __init__(self, fmt=None, datefmt=None, use_color=True): 66 | super().__init__(fmt, datefmt) 67 | self.use_color = use_color 68 | 69 | def format(self, record): 70 | level = record.levelname 71 | color = self.COLORS.get(level, "") if self.use_color else "" 72 | reset = self.COLORS["RESET"] if self.use_color else "" 73 | msg = super().format(record) 74 | return f"{color}{msg}{reset}" 75 | 76 | 77 | config = { 78 | "meshtastic_interface": os.environ.get("MESHTASTIC_INTERFACE"), 79 | "interface_serial_device": os.environ.get("SERIAL_DEVICE", "/dev/ttyACM0"), 80 | "interface_tcp_addr": os.environ.get("INTERFACE_TCP_ADDR"), 81 | "interface_tcp_port": os.environ.get( 82 | "INTERFACE_TCP_PORT", meshtastic.tcp_interface.DEFAULT_TCP_PORT 83 | ), 84 | "interface_ble_addr": os.environ.get("INTERFACE_BLE_ADDR", "AA:BB:CC:DD:EE:FF"), 85 | "mqtt_address": os.environ.get("MQTT_ADDRESS", "mqtt.meshtastic.org"), 86 | "mqtt_use_tls": os.environ.get("MQTT_USE_TLS", False), 87 | "mqtt_port": os.environ.get("MQTT_PORT", 1883), 88 | "mqtt_keepalive": os.environ.get("MQTT_KEEPALIVE", 15), 89 | "mqtt_username": os.environ.get("MQTT_USERNAME"), 90 | "mqtt_password": os.environ.get("MQTT_PASSWORD"), 91 | "mqtt_topic": os.environ.get("MQTT_TOPIC", "msh/EU_433/#"), 92 | "prometheus_server_addr": os.environ.get("PROMETHEUS_SERVER_ADDR", "0.0.0.0"), 93 | "prometheus_server_port": os.environ.get("PROMETHEUS_SERVER_PORT", 9464), 94 | "log_level": os.environ.get("LOG_LEVEL", "INFO"), 95 | "log_color": os.environ.get("LOG_COLOR", True), 96 | "flood_expire_time": int(os.environ.get("FLOOD_EXPIRE_TIME", 10 * 60)), 97 | "enable_sentry": os.environ.get("ENABLE_SENTRY", True), 98 | "sentry_dsn": os.environ.get( 99 | "SENTRY_DSN", 100 | "https://d03452fcb06e7141c5c9a1d6ee370e8d@o4508362511286272.ingest.de.sentry.io/4508362517381200", 101 | ), 102 | } 103 | 104 | logger = logging.getLogger("meshtastic_prometheus_exporter") 105 | logger.propagate = False 106 | 107 | logger.setLevel(getattr(logging, config["log_level"].upper())) 108 | 109 | handler = logging.StreamHandler(stdout) 110 | handler.setFormatter( 111 | ColorFormatter( 112 | "%(asctime)s - meshtastic_prometheus_exporter - %(levelname)s - %(message)s", 113 | use_color=bool(config.get("log_color", False)), 114 | ) 115 | ) 116 | 117 | logger.addHandler(handler) 118 | 119 | try: 120 | reader = PrometheusMetricReader() 121 | start_http_server( 122 | port=config["prometheus_server_port"], addr=config["prometheus_server_addr"] 123 | ) 124 | 125 | provider = MeterProvider( 126 | resource=Resource.create(attributes={"service.name": "meshtastic"}), 127 | metric_readers=[reader], 128 | # views=[], 129 | ) 130 | metrics.set_meter_provider(provider) 131 | meter = metrics.get_meter("meshtastic_prometheus_exporter") 132 | 133 | cache = TTLCache(maxsize=10000, ttl=config["flood_expire_time"]) 134 | 135 | except Exception as e: 136 | logger.fatal( 137 | f"Exception occurred while starting up: {';'.join(traceback.format_exc().splitlines())}" 138 | ) 139 | sys.exit(1) 140 | 141 | 142 | def on_connect(client, userdata, flags, reason_code, properties): 143 | if reason_code.is_failure: 144 | logger.warning( 145 | f"Failed to connect to MQTT server with result code {reason_code}. loop_forever() will retry connection" 146 | ) 147 | else: 148 | logger.info(f"Connected to MQTT server with result code {reason_code}") 149 | client.subscribe(config["mqtt_topic"]) 150 | 151 | 152 | def on_meshtastic_service_envelope(envelope, msg): 153 | logger.debug( 154 | f"Received ServiceEnvelope payload `{msg['payload']}` from `{msg.topic}` topic" 155 | ) 156 | 157 | if envelope: 158 | logger.debug( 159 | f"Decoded ServiceEnvelope payload into MeshPacket `{envelope.packet}`" 160 | ) 161 | on_meshtastic_mesh_packet(envelope.packet) 162 | 163 | 164 | def on_meshtastic_mesh_packet(packet): 165 | if packet.get("encrypted", False): 166 | logger.info(f"Skipping encrypted packet {packet['id']}") 167 | return 168 | 169 | if packet.get("id", None) is None: 170 | return 171 | 172 | # Use the packet id as the cache key for deduplication 173 | unique = cache.setdefault(str(packet["id"]), True) 174 | if not unique: 175 | logger.info(f"Skipping duplicate packet {packet['id']}") 176 | return 177 | 178 | source = packet["decoded"].get("source", packet["from"]) 179 | 180 | source_long_name = get_decoded_node_metadata_from_cache(cache, source, "long_name") 181 | source_short_name = get_decoded_node_metadata_from_cache( 182 | cache, source, "short_name" 183 | ) 184 | from_long_name = get_decoded_node_metadata_from_cache( 185 | cache, packet["from"], "long_name" 186 | ) 187 | from_short_name = get_decoded_node_metadata_from_cache( 188 | cache, packet["from"], "short_name" 189 | ) 190 | to_long_name = get_decoded_node_metadata_from_cache( 191 | cache, packet["to"], "long_name" 192 | ) 193 | to_short_name = get_decoded_node_metadata_from_cache( 194 | cache, packet["to"], "short_name" 195 | ) 196 | 197 | # https://buf.build/meshtastic/protobufs/file/main:meshtastic/portnums.proto 198 | meshtastic_mesh_packets_total.add( 199 | 1, 200 | attributes={ 201 | "source": source, 202 | "source_long_name": source_long_name, 203 | "source_short_name": source_short_name, 204 | "from": packet["from"], 205 | "from_long_name": from_long_name, 206 | "from_short_name": from_short_name, 207 | "to": packet["to"], 208 | "to_long_name": to_long_name, 209 | "to_short_name": to_short_name, 210 | "channel": packet.get("channel", 0), 211 | "type": packet["decoded"]["portnum"], 212 | "hop_limit": packet.get("hopLimit", "unknown"), 213 | "want_ack": packet.get("wantAck", "unknown"), 214 | "delayed": packet.get("delayed", "unknown"), 215 | "via_mqtt": packet.get("viaMqtt", "false"), 216 | }, 217 | ) 218 | if packet["decoded"]["portnum"] == "NODEINFO_APP": 219 | on_meshtastic_nodeinfo_app(cache, packet) 220 | else: 221 | known_source = ( 222 | get_decoded_node_metadata_from_cache(cache, source, "long_name") 223 | != "unknown" 224 | ) 225 | 226 | if not known_source: 227 | logger.info( 228 | f"NodeInfo is now yet known for Node {source}, ignoring the packet {packet['id']}" 229 | ) 230 | return 231 | 232 | if packet["decoded"]["portnum"] == "TELEMETRY_APP": 233 | on_meshtastic_telemetry_app(packet, source_long_name, source_short_name) 234 | 235 | if packet["decoded"]["portnum"] == "NEIGHBORINFO_APP": 236 | on_meshtastic_neighborinfo_app( 237 | cache, packet, source_long_name, source_short_name 238 | ) 239 | 240 | 241 | def on_message(client, userdata, msg): 242 | try: 243 | envelope = mqtt_pb2.ServiceEnvelope.FromString(msg.payload) 244 | packet = envelope.packet 245 | logger.debug( 246 | f"Received UTF-8 payload `{MessageToDict(envelope)}` from `{msg.topic}` topic" 247 | ) 248 | on_native_message(MessageToDict(packet), None) 249 | except Exception as e: 250 | logger.warning(f"Exception occurred in on_message: {e}") 251 | 252 | 253 | def on_native_message(packet, interface): 254 | try: 255 | on_meshtastic_mesh_packet(packet) 256 | except Exception as e: 257 | logger.error( 258 | f"{e} occurred while processing MeshPacket {packet}, please consider submitting a PR/issue on GitHub: `{json.dumps(packet, default=repr)}` {';'.join(traceback.format_exc().splitlines()) 259 | }" 260 | ) 261 | if "sentry_sdk" in globals(): 262 | sentry_sdk.capture_exception(e) 263 | 264 | 265 | def on_native_connection_established(interface, topic=pub.AUTO_TOPIC): 266 | logger.info(f"Connected to device over {type(interface).__name__}") 267 | 268 | 269 | def on_native_connection_lost(interface, topic=pub.AUTO_TOPIC): 270 | logger.warning(f"Lost connection to device over {type(interface).__name__}") 271 | 272 | 273 | def check_and_save_nodedb(iface, cache): 274 | if hasattr(iface, "nodes") and len(iface.nodes) > 0: 275 | logger.info( 276 | f"NodeDB is available, saving metadata in cache for {len(iface.nodes.values())} nodes" 277 | ) 278 | for n in iface.nodes.values(): 279 | save_node_metadata_in_cache( 280 | cache, 281 | n["num"], 282 | { 283 | "longName": n["user"]["longName"], 284 | "shortName": n["user"]["shortName"], 285 | "hwModel": n["user"]["hwModel"], 286 | }, 287 | ) 288 | else: 289 | logger.warning( 290 | "Device NodeDB is empty or not available. NodeInfo packets are not sent often, so populating local NodeDB (stored in memory) may take from several hours to several days or more." 291 | ) 292 | 293 | 294 | def main(): 295 | try: 296 | logger.info( 297 | "Share ideas and vote for new features https://github.com/hacktegic/meshtastic-prometheus-exporter/discussions/categories/ideas" 298 | ) 299 | 300 | if int(config["enable_sentry"]) == 1: 301 | import sentry_sdk 302 | from sentry_sdk import add_breadcrumb 303 | from sentry_sdk.integrations.logging import LoggingIntegration 304 | 305 | logger.warning( 306 | "Enabling error reporting via Sentry. Your unmodified MeshPackets may be sent to maintainers of this project in case of runtime errors. To disable, set ENABLE_SENTRY environment variable to 0" 307 | ) 308 | 309 | sentry_sdk.init( 310 | dsn=config.get("sentry_dsn"), 311 | traces_sample_rate=1.0, 312 | integrations=[ 313 | LoggingIntegration(level=logging.INFO, event_level=logging.FATAL), 314 | ], 315 | ) 316 | else: 317 | logger.warning( 318 | "Sentry error reporting is disabled. To enable automatic error reporting to project maintainers in case of runtime errors, set the ENABLE_SENTRY environment variable to 1." 319 | ) 320 | 321 | if config.get("meshtastic_interface") not in ["MQTT", "SERIAL", "TCP", "BLE"]: 322 | logger.fatal( 323 | f"Invalid value for MESHTASTIC_INTERFACE: {config['meshtastic_interface']}. Must be one of: MQTT, SERIAL, TCP, BLE" 324 | ) 325 | sys.exit(1) 326 | 327 | pub.subscribe(on_native_message, "meshtastic.receive") 328 | pub.subscribe( 329 | on_native_connection_established, "meshtastic.connection.established" 330 | ) 331 | pub.subscribe(on_native_connection_lost, "meshtastic.connection.lost") 332 | 333 | if config.get("meshtastic_interface") == "SERIAL": 334 | iface = meshtastic.serial_interface.SerialInterface( 335 | devPath=config.get("serial_device") 336 | ) 337 | check_and_save_nodedb(iface, cache) 338 | elif config.get("meshtastic_interface") == "TCP": 339 | iface = meshtastic.tcp_interface.TCPInterface( 340 | hostname=config.get("interface_tcp_addr"), 341 | portNumber=int(config.get("interface_tcp_port")), 342 | ) 343 | check_and_save_nodedb(iface, cache) 344 | elif config.get("meshtastic_interface") == "BLE": 345 | iface = meshtastic.ble_interface.BLEInterface( 346 | address=config.get("interface_ble_addr"), 347 | ) 348 | check_and_save_nodedb(iface, cache) 349 | elif config.get("meshtastic_interface") == "MQTT": 350 | mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2) 351 | 352 | mqttc.on_connect = on_connect 353 | mqttc.on_message = on_message 354 | 355 | if int(config["mqtt_use_tls"]) == 1: 356 | tlscontext = ssl.create_default_context() 357 | mqttc.tls_set_context(tlscontext) 358 | 359 | if config["mqtt_username"]: 360 | mqttc.username_pw_set(config["mqtt_username"], config["mqtt_password"]) 361 | 362 | mqttc.connect( 363 | config["mqtt_address"], 364 | int(config["mqtt_port"]), 365 | keepalive=int(config["mqtt_keepalive"]), 366 | ) 367 | 368 | check_and_save_nodedb(object(), cache) 369 | mqttc.loop_forever() 370 | 371 | while True: 372 | time.sleep(1) 373 | 374 | except Exception as e: 375 | logger.fatal( 376 | f"Exception occurred while starting up: {';'.join(traceback.format_exc().splitlines())}" 377 | ) 378 | sys.exit(1) 379 | 380 | 381 | if __name__ == "__main__": 382 | main() 383 | -------------------------------------------------------------------------------- /grafana-dashboards/packets-nodes.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "grafana", 16 | "id": "grafana", 17 | "name": "Grafana", 18 | "version": "10.4.2" 19 | }, 20 | { 21 | "type": "datasource", 22 | "id": "prometheus", 23 | "name": "Prometheus", 24 | "version": "1.0.0" 25 | }, 26 | { 27 | "type": "panel", 28 | "id": "timeseries", 29 | "name": "Time series", 30 | "version": "" 31 | } 32 | ], 33 | "annotations": { 34 | "list": [ 35 | { 36 | "builtIn": 1, 37 | "datasource": { 38 | "type": "grafana", 39 | "uid": "-- Grafana --" 40 | }, 41 | "enable": true, 42 | "hide": true, 43 | "iconColor": "rgba(0, 211, 255, 1)", 44 | "name": "Annotations & Alerts", 45 | "type": "dashboard" 46 | } 47 | ] 48 | }, 49 | "editable": true, 50 | "fiscalYearStartMonth": 0, 51 | "graphTooltip": 0, 52 | "id": null, 53 | "links": [], 54 | "liveNow": false, 55 | "panels": [ 56 | { 57 | "datasource": { 58 | "type": "prometheus", 59 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 60 | }, 61 | "description": "", 62 | "fieldConfig": { 63 | "defaults": { 64 | "color": { 65 | "mode": "palette-classic" 66 | }, 67 | "custom": { 68 | "axisBorderShow": false, 69 | "axisCenteredZero": false, 70 | "axisColorMode": "text", 71 | "axisLabel": "", 72 | "axisPlacement": "auto", 73 | "barAlignment": 0, 74 | "drawStyle": "line", 75 | "fillOpacity": 0, 76 | "gradientMode": "none", 77 | "hideFrom": { 78 | "legend": false, 79 | "tooltip": false, 80 | "viz": false 81 | }, 82 | "insertNulls": false, 83 | "lineInterpolation": "linear", 84 | "lineWidth": 1, 85 | "pointSize": 5, 86 | "scaleDistribution": { 87 | "type": "linear" 88 | }, 89 | "showPoints": "auto", 90 | "spanNulls": true, 91 | "stacking": { 92 | "group": "A", 93 | "mode": "none" 94 | }, 95 | "thresholdsStyle": { 96 | "mode": "off" 97 | } 98 | }, 99 | "decimals": 0, 100 | "mappings": [], 101 | "thresholds": { 102 | "mode": "absolute", 103 | "steps": [ 104 | { 105 | "color": "green", 106 | "value": null 107 | }, 108 | { 109 | "color": "red", 110 | "value": 80 111 | } 112 | ] 113 | }, 114 | "unit": "none" 115 | }, 116 | "overrides": [] 117 | }, 118 | "gridPos": { 119 | "h": 13, 120 | "w": 24, 121 | "x": 0, 122 | "y": 0 123 | }, 124 | "id": 3, 125 | "options": { 126 | "legend": { 127 | "calcs": [ 128 | "lastNotNull", 129 | "sum", 130 | "mean", 131 | "min", 132 | "max" 133 | ], 134 | "displayMode": "table", 135 | "placement": "bottom", 136 | "showLegend": true, 137 | "sortBy": "Total", 138 | "sortDesc": true 139 | }, 140 | "tooltip": { 141 | "mode": "single", 142 | "sort": "none" 143 | } 144 | }, 145 | "targets": [ 146 | { 147 | "datasource": { 148 | "type": "prometheus", 149 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 150 | }, 151 | "disableTextWrap": false, 152 | "editorMode": "code", 153 | "expr": "sum(increase(meshtastic_mesh_packets_total{to=~\"$source\", via_mqtt=\"false\"}[$__interval])) or sum(increase(meshtastic_mesh_packets_total{source_long_name=~\"$source\", via_mqtt=\"false\"}[$__interval]))", 154 | "fullMetaSearch": false, 155 | "includeNullMetadata": true, 156 | "instant": false, 157 | "interval": "1m", 158 | "legendFormat": "__auto", 159 | "range": true, 160 | "refId": "A", 161 | "useBackend": false 162 | } 163 | ], 164 | "title": "Packet rate", 165 | "type": "timeseries" 166 | }, 167 | { 168 | "datasource": { 169 | "type": "prometheus", 170 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 171 | }, 172 | "fieldConfig": { 173 | "defaults": { 174 | "color": { 175 | "mode": "palette-classic" 176 | }, 177 | "custom": { 178 | "axisBorderShow": false, 179 | "axisCenteredZero": false, 180 | "axisColorMode": "text", 181 | "axisLabel": "", 182 | "axisPlacement": "auto", 183 | "barAlignment": 0, 184 | "drawStyle": "line", 185 | "fillOpacity": 0, 186 | "gradientMode": "none", 187 | "hideFrom": { 188 | "legend": false, 189 | "tooltip": false, 190 | "viz": false 191 | }, 192 | "insertNulls": false, 193 | "lineInterpolation": "linear", 194 | "lineWidth": 1, 195 | "pointSize": 5, 196 | "scaleDistribution": { 197 | "type": "linear" 198 | }, 199 | "showPoints": "auto", 200 | "spanNulls": true, 201 | "stacking": { 202 | "group": "A", 203 | "mode": "none" 204 | }, 205 | "thresholdsStyle": { 206 | "mode": "off" 207 | } 208 | }, 209 | "decimals": 0, 210 | "mappings": [], 211 | "thresholds": { 212 | "mode": "absolute", 213 | "steps": [ 214 | { 215 | "color": "green", 216 | "value": null 217 | }, 218 | { 219 | "color": "red", 220 | "value": 80 221 | } 222 | ] 223 | }, 224 | "unit": "none" 225 | }, 226 | "overrides": [] 227 | }, 228 | "gridPos": { 229 | "h": 13, 230 | "w": 24, 231 | "x": 0, 232 | "y": 13 233 | }, 234 | "id": 4, 235 | "options": { 236 | "legend": { 237 | "calcs": [ 238 | "lastNotNull", 239 | "sum", 240 | "mean", 241 | "min", 242 | "max" 243 | ], 244 | "displayMode": "table", 245 | "placement": "right", 246 | "showLegend": true, 247 | "sortBy": "Total", 248 | "sortDesc": true 249 | }, 250 | "tooltip": { 251 | "mode": "single", 252 | "sort": "none" 253 | } 254 | }, 255 | "targets": [ 256 | { 257 | "datasource": { 258 | "type": "prometheus", 259 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 260 | }, 261 | "disableTextWrap": false, 262 | "editorMode": "code", 263 | "expr": "sum by(source, source_long_name, type) (increase(meshtastic_mesh_packets_total{source_long_name=~\"$source\", to=\"4294967295\"}[$__interval]))", 264 | "fullMetaSearch": false, 265 | "includeNullMetadata": true, 266 | "instant": false, 267 | "interval": "1m", 268 | "legendFormat": "{{source_long_name}} ({{source}}) - {{type}}", 269 | "range": true, 270 | "refId": "A", 271 | "useBackend": false 272 | } 273 | ], 274 | "title": "Packets by source & type (broadcast)", 275 | "type": "timeseries" 276 | }, 277 | { 278 | "datasource": { 279 | "type": "prometheus", 280 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 281 | }, 282 | "fieldConfig": { 283 | "defaults": { 284 | "color": { 285 | "mode": "palette-classic" 286 | }, 287 | "custom": { 288 | "axisCenteredZero": false, 289 | "axisColorMode": "text", 290 | "axisLabel": "", 291 | "axisPlacement": "auto", 292 | "barAlignment": 0, 293 | "drawStyle": "line", 294 | "fillOpacity": 0, 295 | "gradientMode": "none", 296 | "hideFrom": { 297 | "legend": false, 298 | "tooltip": false, 299 | "viz": false 300 | }, 301 | "insertNulls": false, 302 | "lineInterpolation": "linear", 303 | "lineWidth": 1, 304 | "pointSize": 5, 305 | "scaleDistribution": { 306 | "type": "linear" 307 | }, 308 | "showPoints": "auto", 309 | "spanNulls": true, 310 | "stacking": { 311 | "group": "A", 312 | "mode": "none" 313 | }, 314 | "thresholdsStyle": { 315 | "mode": "off" 316 | } 317 | }, 318 | "decimals": 0, 319 | "mappings": [], 320 | "thresholds": { 321 | "mode": "absolute", 322 | "steps": [ 323 | { 324 | "color": "green" 325 | }, 326 | { 327 | "color": "red", 328 | "value": 80 329 | } 330 | ] 331 | }, 332 | "unit": "none" 333 | }, 334 | "overrides": [] 335 | }, 336 | "gridPos": { 337 | "h": 13, 338 | "w": 24, 339 | "x": 0, 340 | "y": 26 341 | }, 342 | "id": 6, 343 | "options": { 344 | "legend": { 345 | "calcs": [ 346 | "lastNotNull", 347 | "sum", 348 | "mean", 349 | "min", 350 | "max" 351 | ], 352 | "displayMode": "table", 353 | "placement": "right", 354 | "showLegend": true, 355 | "sortBy": "Total", 356 | "sortDesc": true 357 | }, 358 | "tooltip": { 359 | "mode": "single", 360 | "sort": "none" 361 | } 362 | }, 363 | "targets": [ 364 | { 365 | "datasource": { 366 | "type": "prometheus", 367 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 368 | }, 369 | "disableTextWrap": false, 370 | "editorMode": "code", 371 | "expr": "sum by(to, from, to_long_name, from_long_name, type) (increase(meshtastic_mesh_packets_total{source_long_name=~\"$source\", to!=\"4294967295\"}[$__interval])) or sum by(to, from, to_long_name, from_long_name, type) (increase(meshtastic_mesh_packets_total{to=~\"$source\", to!=\"4294967295\"}[$__interval]))", 372 | "fullMetaSearch": false, 373 | "includeNullMetadata": true, 374 | "instant": false, 375 | "interval": "1m", 376 | "legendFormat": "{{from_long_name}} ({{from}}) -> {{to_long_name}} ({{to}}) - {{type}}", 377 | "range": true, 378 | "refId": "A", 379 | "useBackend": false 380 | } 381 | ], 382 | "title": "Packets by talkers & type (unicast)", 383 | "type": "timeseries" 384 | }, 385 | { 386 | "datasource": { 387 | "type": "prometheus", 388 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 389 | }, 390 | "fieldConfig": { 391 | "defaults": { 392 | "color": { 393 | "mode": "palette-classic" 394 | }, 395 | "custom": { 396 | "axisCenteredZero": false, 397 | "axisColorMode": "text", 398 | "axisLabel": "", 399 | "axisPlacement": "auto", 400 | "barAlignment": 0, 401 | "drawStyle": "line", 402 | "fillOpacity": 0, 403 | "gradientMode": "none", 404 | "hideFrom": { 405 | "legend": false, 406 | "tooltip": false, 407 | "viz": false 408 | }, 409 | "insertNulls": false, 410 | "lineInterpolation": "linear", 411 | "lineWidth": 1, 412 | "pointSize": 5, 413 | "scaleDistribution": { 414 | "type": "linear" 415 | }, 416 | "showPoints": "auto", 417 | "spanNulls": true, 418 | "stacking": { 419 | "group": "A", 420 | "mode": "none" 421 | }, 422 | "thresholdsStyle": { 423 | "mode": "off" 424 | } 425 | }, 426 | "decimals": 0, 427 | "mappings": [], 428 | "thresholds": { 429 | "mode": "absolute", 430 | "steps": [ 431 | { 432 | "color": "green" 433 | }, 434 | { 435 | "color": "red", 436 | "value": 80 437 | } 438 | ] 439 | }, 440 | "unit": "none" 441 | }, 442 | "overrides": [] 443 | }, 444 | "gridPos": { 445 | "h": 14, 446 | "w": 24, 447 | "x": 0, 448 | "y": 39 449 | }, 450 | "id": 2, 451 | "options": { 452 | "legend": { 453 | "calcs": [ 454 | "lastNotNull", 455 | "sum", 456 | "mean", 457 | "min", 458 | "max" 459 | ], 460 | "displayMode": "table", 461 | "placement": "right", 462 | "showLegend": true, 463 | "sortBy": "Total", 464 | "sortDesc": true 465 | }, 466 | "tooltip": { 467 | "mode": "single", 468 | "sort": "none" 469 | } 470 | }, 471 | "targets": [ 472 | { 473 | "datasource": { 474 | "type": "prometheus", 475 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 476 | }, 477 | "disableTextWrap": false, 478 | "editorMode": "code", 479 | "expr": "sum(increase(meshtastic_mesh_packets_total{to=~\"$source\"}[$__interval])) by (type) or sum(increase(meshtastic_mesh_packets_total{source_long_name=~\"$source\"}[$__interval])) by (type) ", 480 | "fullMetaSearch": false, 481 | "includeNullMetadata": true, 482 | "instant": false, 483 | "interval": "1m", 484 | "legendFormat": "__auto", 485 | "range": true, 486 | "refId": "A", 487 | "useBackend": false 488 | } 489 | ], 490 | "title": "Packets by type", 491 | "type": "timeseries" 492 | } 493 | ], 494 | "refresh": "30s", 495 | "schemaVersion": 39, 496 | "tags": [], 497 | "templating": { 498 | "list": [ 499 | { 500 | "current": {}, 501 | "datasource": { 502 | "type": "prometheus", 503 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 504 | }, 505 | "definition": "label_values(meshtastic_mesh_packets_total,source_long_name)", 506 | "hide": 0, 507 | "includeAll": false, 508 | "multi": true, 509 | "name": "source", 510 | "options": [], 511 | "query": { 512 | "qryType": 1, 513 | "query": "label_values(meshtastic_mesh_packets_total,source_long_name)", 514 | "refId": "PrometheusVariableQueryEditor-VariableQuery" 515 | }, 516 | "refresh": 1, 517 | "regex": "", 518 | "skipUrlSync": false, 519 | "sort": 5, 520 | "type": "query" 521 | } 522 | ] 523 | }, 524 | "time": { 525 | "from": "now-6h", 526 | "to": "now" 527 | }, 528 | "timepicker": {}, 529 | "timezone": "", 530 | "title": "Meshtastic Packets (Nodes)", 531 | "uid": "dfe109f7-17b6-467b-97bf-2e9c6508e0fc", 532 | "version": 2, 533 | "weekStart": "" 534 | } -------------------------------------------------------------------------------- /grafana-dashboards/packets-net.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "panel", 16 | "id": "bargauge", 17 | "name": "Bar gauge", 18 | "version": "" 19 | }, 20 | { 21 | "type": "grafana", 22 | "id": "grafana", 23 | "name": "Grafana", 24 | "version": "10.4.2" 25 | }, 26 | { 27 | "type": "datasource", 28 | "id": "prometheus", 29 | "name": "Prometheus", 30 | "version": "1.0.0" 31 | }, 32 | { 33 | "type": "panel", 34 | "id": "timeseries", 35 | "name": "Time series", 36 | "version": "" 37 | } 38 | ], 39 | "annotations": { 40 | "list": [ 41 | { 42 | "builtIn": 1, 43 | "datasource": { 44 | "type": "grafana", 45 | "uid": "-- Grafana --" 46 | }, 47 | "enable": true, 48 | "hide": true, 49 | "iconColor": "rgba(0, 211, 255, 1)", 50 | "name": "Annotations & Alerts", 51 | "type": "dashboard" 52 | } 53 | ] 54 | }, 55 | "editable": true, 56 | "fiscalYearStartMonth": 0, 57 | "graphTooltip": 0, 58 | "id": null, 59 | "links": [], 60 | "liveNow": false, 61 | "panels": [ 62 | { 63 | "datasource": { 64 | "type": "prometheus", 65 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 66 | }, 67 | "description": "", 68 | "fieldConfig": { 69 | "defaults": { 70 | "color": { 71 | "mode": "palette-classic" 72 | }, 73 | "custom": { 74 | "axisBorderShow": false, 75 | "axisCenteredZero": false, 76 | "axisColorMode": "text", 77 | "axisLabel": "", 78 | "axisPlacement": "auto", 79 | "barAlignment": 0, 80 | "drawStyle": "line", 81 | "fillOpacity": 0, 82 | "gradientMode": "none", 83 | "hideFrom": { 84 | "legend": false, 85 | "tooltip": false, 86 | "viz": false 87 | }, 88 | "insertNulls": false, 89 | "lineInterpolation": "linear", 90 | "lineWidth": 1, 91 | "pointSize": 5, 92 | "scaleDistribution": { 93 | "type": "linear" 94 | }, 95 | "showPoints": "auto", 96 | "spanNulls": true, 97 | "stacking": { 98 | "group": "A", 99 | "mode": "none" 100 | }, 101 | "thresholdsStyle": { 102 | "mode": "off" 103 | } 104 | }, 105 | "decimals": 0, 106 | "mappings": [], 107 | "thresholds": { 108 | "mode": "absolute", 109 | "steps": [ 110 | { 111 | "color": "green", 112 | "value": null 113 | }, 114 | { 115 | "color": "red", 116 | "value": 80 117 | } 118 | ] 119 | }, 120 | "unit": "none" 121 | }, 122 | "overrides": [] 123 | }, 124 | "gridPos": { 125 | "h": 13, 126 | "w": 24, 127 | "x": 0, 128 | "y": 0 129 | }, 130 | "id": 3, 131 | "options": { 132 | "legend": { 133 | "calcs": [ 134 | "lastNotNull", 135 | "sum", 136 | "mean", 137 | "min", 138 | "max" 139 | ], 140 | "displayMode": "table", 141 | "placement": "bottom", 142 | "showLegend": true, 143 | "sortBy": "Total", 144 | "sortDesc": true 145 | }, 146 | "tooltip": { 147 | "mode": "single", 148 | "sort": "none" 149 | } 150 | }, 151 | "targets": [ 152 | { 153 | "datasource": { 154 | "type": "prometheus", 155 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 156 | }, 157 | "disableTextWrap": false, 158 | "editorMode": "builder", 159 | "expr": "sum(increase(meshtastic_mesh_packets_total{via_mqtt=\"false\"}[$__interval]))", 160 | "fullMetaSearch": false, 161 | "includeNullMetadata": true, 162 | "instant": false, 163 | "interval": "1m", 164 | "legendFormat": "__auto", 165 | "range": true, 166 | "refId": "A", 167 | "useBackend": false 168 | } 169 | ], 170 | "title": "Packet rate", 171 | "type": "timeseries" 172 | }, 173 | { 174 | "datasource": { 175 | "type": "prometheus", 176 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 177 | }, 178 | "fieldConfig": { 179 | "defaults": { 180 | "color": { 181 | "mode": "thresholds" 182 | }, 183 | "decimals": 0, 184 | "mappings": [], 185 | "thresholds": { 186 | "mode": "absolute", 187 | "steps": [ 188 | { 189 | "color": "green", 190 | "value": null 191 | }, 192 | { 193 | "color": "red", 194 | "value": 80 195 | } 196 | ] 197 | }, 198 | "unit": "none" 199 | }, 200 | "overrides": [] 201 | }, 202 | "gridPos": { 203 | "h": 13, 204 | "w": 24, 205 | "x": 0, 206 | "y": 13 207 | }, 208 | "id": 4, 209 | "options": { 210 | "displayMode": "gradient", 211 | "maxVizHeight": 300, 212 | "minVizHeight": 16, 213 | "minVizWidth": 8, 214 | "namePlacement": "auto", 215 | "orientation": "auto", 216 | "reduceOptions": { 217 | "calcs": [ 218 | "lastNotNull" 219 | ], 220 | "fields": "", 221 | "values": false 222 | }, 223 | "showUnfilled": true, 224 | "sizing": "auto", 225 | "valueMode": "color" 226 | }, 227 | "pluginVersion": "10.4.2", 228 | "targets": [ 229 | { 230 | "datasource": { 231 | "type": "prometheus", 232 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 233 | }, 234 | "disableTextWrap": false, 235 | "editorMode": "code", 236 | "expr": "sum by(hop_limit) (increase(meshtastic_mesh_packets_total[$__range])) > 0", 237 | "fullMetaSearch": false, 238 | "includeNullMetadata": true, 239 | "instant": false, 240 | "interval": "1m", 241 | "legendFormat": "__auto", 242 | "range": true, 243 | "refId": "A", 244 | "useBackend": false 245 | } 246 | ], 247 | "title": "Packets by hop limit", 248 | "type": "bargauge" 249 | }, 250 | { 251 | "datasource": { 252 | "type": "prometheus", 253 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 254 | }, 255 | "fieldConfig": { 256 | "defaults": { 257 | "color": { 258 | "mode": "palette-classic" 259 | }, 260 | "custom": { 261 | "axisBorderShow": false, 262 | "axisCenteredZero": false, 263 | "axisColorMode": "text", 264 | "axisLabel": "", 265 | "axisPlacement": "auto", 266 | "barAlignment": 0, 267 | "drawStyle": "line", 268 | "fillOpacity": 0, 269 | "gradientMode": "none", 270 | "hideFrom": { 271 | "legend": false, 272 | "tooltip": false, 273 | "viz": false 274 | }, 275 | "insertNulls": false, 276 | "lineInterpolation": "linear", 277 | "lineWidth": 1, 278 | "pointSize": 5, 279 | "scaleDistribution": { 280 | "type": "linear" 281 | }, 282 | "showPoints": "auto", 283 | "spanNulls": true, 284 | "stacking": { 285 | "group": "A", 286 | "mode": "none" 287 | }, 288 | "thresholdsStyle": { 289 | "mode": "off" 290 | } 291 | }, 292 | "decimals": 0, 293 | "mappings": [], 294 | "thresholds": { 295 | "mode": "absolute", 296 | "steps": [ 297 | { 298 | "color": "green", 299 | "value": null 300 | }, 301 | { 302 | "color": "red", 303 | "value": 80 304 | } 305 | ] 306 | }, 307 | "unit": "none" 308 | }, 309 | "overrides": [] 310 | }, 311 | "gridPos": { 312 | "h": 13, 313 | "w": 24, 314 | "x": 0, 315 | "y": 26 316 | }, 317 | "id": 7, 318 | "options": { 319 | "legend": { 320 | "calcs": [ 321 | "lastNotNull", 322 | "sum", 323 | "mean", 324 | "min", 325 | "max" 326 | ], 327 | "displayMode": "table", 328 | "placement": "right", 329 | "showLegend": true, 330 | "sortBy": "Total", 331 | "sortDesc": true 332 | }, 333 | "tooltip": { 334 | "mode": "single", 335 | "sort": "none" 336 | } 337 | }, 338 | "targets": [ 339 | { 340 | "datasource": { 341 | "type": "prometheus", 342 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 343 | }, 344 | "disableTextWrap": false, 345 | "editorMode": "code", 346 | "expr": "sum by(source, source_long_name, type) (increase(meshtastic_mesh_packets_total{to=\"4294967295\"}[$__interval]))", 347 | "fullMetaSearch": false, 348 | "includeNullMetadata": true, 349 | "instant": false, 350 | "interval": "1m", 351 | "legendFormat": "{{source_long_name}} ({{source}}) - {{type}}", 352 | "range": true, 353 | "refId": "A", 354 | "useBackend": false 355 | } 356 | ], 357 | "title": "Packets by source & type (broadcast)", 358 | "type": "timeseries" 359 | }, 360 | { 361 | "datasource": { 362 | "type": "prometheus", 363 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 364 | }, 365 | "fieldConfig": { 366 | "defaults": { 367 | "color": { 368 | "mode": "palette-classic" 369 | }, 370 | "custom": { 371 | "axisBorderShow": false, 372 | "axisCenteredZero": false, 373 | "axisColorMode": "text", 374 | "axisLabel": "", 375 | "axisPlacement": "auto", 376 | "barAlignment": 0, 377 | "drawStyle": "line", 378 | "fillOpacity": 0, 379 | "gradientMode": "none", 380 | "hideFrom": { 381 | "legend": false, 382 | "tooltip": false, 383 | "viz": false 384 | }, 385 | "insertNulls": false, 386 | "lineInterpolation": "linear", 387 | "lineWidth": 1, 388 | "pointSize": 5, 389 | "scaleDistribution": { 390 | "type": "linear" 391 | }, 392 | "showPoints": "auto", 393 | "spanNulls": true, 394 | "stacking": { 395 | "group": "A", 396 | "mode": "none" 397 | }, 398 | "thresholdsStyle": { 399 | "mode": "off" 400 | } 401 | }, 402 | "decimals": 0, 403 | "mappings": [], 404 | "thresholds": { 405 | "mode": "absolute", 406 | "steps": [ 407 | { 408 | "color": "green", 409 | "value": null 410 | }, 411 | { 412 | "color": "red", 413 | "value": 80 414 | } 415 | ] 416 | }, 417 | "unit": "none" 418 | }, 419 | "overrides": [] 420 | }, 421 | "gridPos": { 422 | "h": 13, 423 | "w": 24, 424 | "x": 0, 425 | "y": 39 426 | }, 427 | "id": 6, 428 | "options": { 429 | "legend": { 430 | "calcs": [ 431 | "lastNotNull", 432 | "sum", 433 | "mean", 434 | "min", 435 | "max" 436 | ], 437 | "displayMode": "table", 438 | "placement": "right", 439 | "showLegend": true, 440 | "sortBy": "Total", 441 | "sortDesc": true 442 | }, 443 | "tooltip": { 444 | "mode": "single", 445 | "sort": "none" 446 | } 447 | }, 448 | "targets": [ 449 | { 450 | "datasource": { 451 | "type": "prometheus", 452 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 453 | }, 454 | "disableTextWrap": false, 455 | "editorMode": "code", 456 | "expr": "sum by(to, from, to_long_name, from_long_name, type) (increase(meshtastic_mesh_packets_total{to!=\"4294967295\"}[$__interval]))", 457 | "fullMetaSearch": false, 458 | "includeNullMetadata": true, 459 | "instant": false, 460 | "interval": "1m", 461 | "legendFormat": "{{from_long_name}} ({{from}}) -> {{to_long_name}} ({{to}}) - {{type}}", 462 | "range": true, 463 | "refId": "A", 464 | "useBackend": false 465 | } 466 | ], 467 | "title": "Packets by talkers & type (unicast)", 468 | "type": "timeseries" 469 | }, 470 | { 471 | "datasource": { 472 | "type": "prometheus", 473 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 474 | }, 475 | "fieldConfig": { 476 | "defaults": { 477 | "color": { 478 | "mode": "palette-classic" 479 | }, 480 | "custom": { 481 | "axisBorderShow": false, 482 | "axisCenteredZero": false, 483 | "axisColorMode": "text", 484 | "axisLabel": "", 485 | "axisPlacement": "auto", 486 | "barAlignment": 0, 487 | "drawStyle": "line", 488 | "fillOpacity": 0, 489 | "gradientMode": "none", 490 | "hideFrom": { 491 | "legend": false, 492 | "tooltip": false, 493 | "viz": false 494 | }, 495 | "insertNulls": false, 496 | "lineInterpolation": "linear", 497 | "lineWidth": 1, 498 | "pointSize": 5, 499 | "scaleDistribution": { 500 | "type": "linear" 501 | }, 502 | "showPoints": "auto", 503 | "spanNulls": true, 504 | "stacking": { 505 | "group": "A", 506 | "mode": "none" 507 | }, 508 | "thresholdsStyle": { 509 | "mode": "off" 510 | } 511 | }, 512 | "decimals": 0, 513 | "mappings": [], 514 | "thresholds": { 515 | "mode": "absolute", 516 | "steps": [ 517 | { 518 | "color": "green", 519 | "value": null 520 | }, 521 | { 522 | "color": "red", 523 | "value": 80 524 | } 525 | ] 526 | }, 527 | "unit": "none" 528 | }, 529 | "overrides": [] 530 | }, 531 | "gridPos": { 532 | "h": 14, 533 | "w": 24, 534 | "x": 0, 535 | "y": 52 536 | }, 537 | "id": 2, 538 | "options": { 539 | "legend": { 540 | "calcs": [ 541 | "lastNotNull", 542 | "sum", 543 | "mean", 544 | "min", 545 | "max" 546 | ], 547 | "displayMode": "table", 548 | "placement": "right", 549 | "showLegend": true, 550 | "sortBy": "Total", 551 | "sortDesc": true 552 | }, 553 | "tooltip": { 554 | "mode": "single", 555 | "sort": "none" 556 | } 557 | }, 558 | "targets": [ 559 | { 560 | "datasource": { 561 | "type": "prometheus", 562 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 563 | }, 564 | "disableTextWrap": false, 565 | "editorMode": "code", 566 | "expr": "sum(increase(meshtastic_mesh_packets_total[$__interval])) by (type) ", 567 | "fullMetaSearch": false, 568 | "includeNullMetadata": true, 569 | "instant": false, 570 | "interval": "1m", 571 | "legendFormat": "__auto", 572 | "range": true, 573 | "refId": "A", 574 | "useBackend": false 575 | } 576 | ], 577 | "title": "Packets by type", 578 | "type": "timeseries" 579 | } 580 | ], 581 | "refresh": "30s", 582 | "schemaVersion": 39, 583 | "tags": [], 584 | "templating": { 585 | "list": [] 586 | }, 587 | "time": { 588 | "from": "now-6h", 589 | "to": "now" 590 | }, 591 | "timepicker": {}, 592 | "timezone": "", 593 | "title": "Meshtastic Packets (Net)", 594 | "uid": "dfe109f7-17b6-467b-97bf-2e9c6508e0fb", 595 | "version": 1, 596 | "weekStart": "" 597 | } -------------------------------------------------------------------------------- /grafana-dashboards/telemetry-net.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "grafana", 16 | "id": "grafana", 17 | "name": "Grafana", 18 | "version": "10.4.2" 19 | }, 20 | { 21 | "type": "datasource", 22 | "id": "prometheus", 23 | "name": "Prometheus", 24 | "version": "1.0.0" 25 | }, 26 | { 27 | "type": "panel", 28 | "id": "timeseries", 29 | "name": "Time series", 30 | "version": "" 31 | } 32 | ], 33 | "annotations": { 34 | "list": [ 35 | { 36 | "builtIn": 1, 37 | "datasource": { 38 | "type": "grafana", 39 | "uid": "-- Grafana --" 40 | }, 41 | "enable": true, 42 | "hide": true, 43 | "iconColor": "rgba(0, 211, 255, 1)", 44 | "name": "Annotations & Alerts", 45 | "type": "dashboard" 46 | } 47 | ] 48 | }, 49 | "editable": true, 50 | "fiscalYearStartMonth": 0, 51 | "graphTooltip": 0, 52 | "id": null, 53 | "links": [], 54 | "liveNow": false, 55 | "panels": [ 56 | { 57 | "datasource": { 58 | "type": "prometheus", 59 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 60 | }, 61 | "fieldConfig": { 62 | "defaults": { 63 | "color": { 64 | "mode": "palette-classic", 65 | "seriesBy": "last" 66 | }, 67 | "custom": { 68 | "axisBorderShow": false, 69 | "axisCenteredZero": false, 70 | "axisColorMode": "text", 71 | "axisLabel": "", 72 | "axisPlacement": "auto", 73 | "barAlignment": 0, 74 | "drawStyle": "line", 75 | "fillOpacity": 0, 76 | "gradientMode": "none", 77 | "hideFrom": { 78 | "legend": false, 79 | "tooltip": false, 80 | "viz": false 81 | }, 82 | "insertNulls": false, 83 | "lineInterpolation": "linear", 84 | "lineWidth": 1, 85 | "pointSize": 5, 86 | "scaleDistribution": { 87 | "type": "linear" 88 | }, 89 | "showPoints": "always", 90 | "spanNulls": true, 91 | "stacking": { 92 | "group": "A", 93 | "mode": "none" 94 | }, 95 | "thresholdsStyle": { 96 | "mode": "off" 97 | } 98 | }, 99 | "mappings": [], 100 | "max": 110, 101 | "min": 0, 102 | "thresholds": { 103 | "mode": "absolute", 104 | "steps": [ 105 | { 106 | "color": "dark-green", 107 | "value": null 108 | } 109 | ] 110 | }, 111 | "unit": "percent" 112 | }, 113 | "overrides": [] 114 | }, 115 | "gridPos": { 116 | "h": 9, 117 | "w": 24, 118 | "x": 0, 119 | "y": 0 120 | }, 121 | "id": 11, 122 | "options": { 123 | "legend": { 124 | "calcs": [ 125 | "lastNotNull" 126 | ], 127 | "displayMode": "table", 128 | "placement": "right", 129 | "showLegend": true, 130 | "sortBy": "Last *", 131 | "sortDesc": false 132 | }, 133 | "tooltip": { 134 | "mode": "single", 135 | "sort": "none" 136 | } 137 | }, 138 | "targets": [ 139 | { 140 | "datasource": { 141 | "type": "prometheus", 142 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 143 | }, 144 | "disableTextWrap": false, 145 | "editorMode": "code", 146 | "exemplar": false, 147 | "expr": "avg_over_time(meshtastic_telemetry_device_battery_level_percent{source_long_name=~\"$source\"}[$__interval])", 148 | "fullMetaSearch": false, 149 | "includeNullMetadata": true, 150 | "instant": false, 151 | "interval": "1m", 152 | "legendFormat": "{{source_long_name}} ({{source}})", 153 | "range": true, 154 | "refId": "A", 155 | "useBackend": false 156 | } 157 | ], 158 | "title": "Battery level", 159 | "type": "timeseries" 160 | }, 161 | { 162 | "datasource": { 163 | "type": "prometheus", 164 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 165 | }, 166 | "fieldConfig": { 167 | "defaults": { 168 | "color": { 169 | "mode": "palette-classic", 170 | "seriesBy": "last" 171 | }, 172 | "custom": { 173 | "axisBorderShow": false, 174 | "axisCenteredZero": false, 175 | "axisColorMode": "text", 176 | "axisLabel": "", 177 | "axisPlacement": "auto", 178 | "barAlignment": 0, 179 | "drawStyle": "line", 180 | "fillOpacity": 0, 181 | "gradientMode": "none", 182 | "hideFrom": { 183 | "legend": false, 184 | "tooltip": false, 185 | "viz": false 186 | }, 187 | "insertNulls": false, 188 | "lineInterpolation": "linear", 189 | "lineWidth": 1, 190 | "pointSize": 5, 191 | "scaleDistribution": { 192 | "type": "linear" 193 | }, 194 | "showPoints": "always", 195 | "spanNulls": true, 196 | "stacking": { 197 | "group": "A", 198 | "mode": "none" 199 | }, 200 | "thresholdsStyle": { 201 | "mode": "off" 202 | } 203 | }, 204 | "mappings": [], 205 | "thresholds": { 206 | "mode": "absolute", 207 | "steps": [ 208 | { 209 | "color": "dark-green", 210 | "value": null 211 | } 212 | ] 213 | }, 214 | "unit": "celsius" 215 | }, 216 | "overrides": [] 217 | }, 218 | "gridPos": { 219 | "h": 8, 220 | "w": 12, 221 | "x": 0, 222 | "y": 9 223 | }, 224 | "id": 12, 225 | "options": { 226 | "legend": { 227 | "calcs": [ 228 | "lastNotNull" 229 | ], 230 | "displayMode": "table", 231 | "placement": "right", 232 | "showLegend": true, 233 | "sortBy": "Last *", 234 | "sortDesc": true 235 | }, 236 | "tooltip": { 237 | "mode": "single", 238 | "sort": "none" 239 | } 240 | }, 241 | "targets": [ 242 | { 243 | "datasource": { 244 | "type": "prometheus", 245 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 246 | }, 247 | "disableTextWrap": false, 248 | "editorMode": "code", 249 | "exemplar": false, 250 | "expr": "avg_over_time(meshtastic_telemetry_env_temperature_celsius{source_long_name=~\"$source\"}[$__interval])", 251 | "fullMetaSearch": false, 252 | "includeNullMetadata": true, 253 | "instant": false, 254 | "interval": "1m", 255 | "legendFormat": "{{source_long_name}} ({{source}})", 256 | "range": true, 257 | "refId": "A", 258 | "useBackend": false 259 | } 260 | ], 261 | "title": "Temperature", 262 | "type": "timeseries" 263 | }, 264 | { 265 | "datasource": { 266 | "type": "prometheus", 267 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 268 | }, 269 | "fieldConfig": { 270 | "defaults": { 271 | "color": { 272 | "mode": "palette-classic", 273 | "seriesBy": "last" 274 | }, 275 | "custom": { 276 | "axisBorderShow": false, 277 | "axisCenteredZero": false, 278 | "axisColorMode": "text", 279 | "axisLabel": "", 280 | "axisPlacement": "auto", 281 | "barAlignment": 0, 282 | "drawStyle": "line", 283 | "fillOpacity": 0, 284 | "gradientMode": "none", 285 | "hideFrom": { 286 | "legend": false, 287 | "tooltip": false, 288 | "viz": false 289 | }, 290 | "insertNulls": false, 291 | "lineInterpolation": "linear", 292 | "lineWidth": 1, 293 | "pointSize": 5, 294 | "scaleDistribution": { 295 | "type": "linear" 296 | }, 297 | "showPoints": "always", 298 | "spanNulls": true, 299 | "stacking": { 300 | "group": "A", 301 | "mode": "none" 302 | }, 303 | "thresholdsStyle": { 304 | "mode": "off" 305 | } 306 | }, 307 | "decimals": 1, 308 | "mappings": [], 309 | "thresholds": { 310 | "mode": "absolute", 311 | "steps": [ 312 | { 313 | "color": "dark-green", 314 | "value": null 315 | } 316 | ] 317 | }, 318 | "unit": "mmHg" 319 | }, 320 | "overrides": [] 321 | }, 322 | "gridPos": { 323 | "h": 8, 324 | "w": 12, 325 | "x": 12, 326 | "y": 9 327 | }, 328 | "id": 15, 329 | "options": { 330 | "legend": { 331 | "calcs": [ 332 | "lastNotNull" 333 | ], 334 | "displayMode": "table", 335 | "placement": "right", 336 | "showLegend": true, 337 | "sortBy": "Last *", 338 | "sortDesc": true 339 | }, 340 | "tooltip": { 341 | "mode": "single", 342 | "sort": "none" 343 | } 344 | }, 345 | "targets": [ 346 | { 347 | "datasource": { 348 | "type": "prometheus", 349 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 350 | }, 351 | "disableTextWrap": false, 352 | "editorMode": "code", 353 | "exemplar": false, 354 | "expr": "avg_over_time(meshtastic_telemetry_env_barometric_pressure_pascal {source_long_name=~\"$source\"}[$__interval]) / 133.3", 355 | "fullMetaSearch": false, 356 | "includeNullMetadata": true, 357 | "instant": false, 358 | "interval": "1m", 359 | "legendFormat": "{{source_long_name}} ({{source}})", 360 | "range": true, 361 | "refId": "A", 362 | "useBackend": false 363 | } 364 | ], 365 | "title": "Barometric pressure", 366 | "type": "timeseries" 367 | }, 368 | { 369 | "datasource": { 370 | "type": "prometheus", 371 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 372 | }, 373 | "fieldConfig": { 374 | "defaults": { 375 | "color": { 376 | "mode": "palette-classic" 377 | }, 378 | "custom": { 379 | "axisBorderShow": false, 380 | "axisCenteredZero": false, 381 | "axisColorMode": "text", 382 | "axisLabel": "", 383 | "axisPlacement": "auto", 384 | "barAlignment": 0, 385 | "drawStyle": "line", 386 | "fillOpacity": 0, 387 | "gradientMode": "none", 388 | "hideFrom": { 389 | "legend": false, 390 | "tooltip": false, 391 | "viz": false 392 | }, 393 | "insertNulls": false, 394 | "lineInterpolation": "linear", 395 | "lineWidth": 1, 396 | "pointSize": 5, 397 | "scaleDistribution": { 398 | "type": "linear" 399 | }, 400 | "showPoints": "always", 401 | "spanNulls": true, 402 | "stacking": { 403 | "group": "A", 404 | "mode": "none" 405 | }, 406 | "thresholdsStyle": { 407 | "mode": "off" 408 | } 409 | }, 410 | "mappings": [], 411 | "thresholds": { 412 | "mode": "absolute", 413 | "steps": [ 414 | { 415 | "color": "green", 416 | "value": null 417 | }, 418 | { 419 | "color": "red", 420 | "value": 80 421 | } 422 | ] 423 | }, 424 | "unit": "percent" 425 | }, 426 | "overrides": [] 427 | }, 428 | "gridPos": { 429 | "h": 16, 430 | "w": 12, 431 | "x": 0, 432 | "y": 17 433 | }, 434 | "id": 9, 435 | "options": { 436 | "legend": { 437 | "calcs": [ 438 | "lastNotNull", 439 | "mean", 440 | "min", 441 | "max" 442 | ], 443 | "displayMode": "table", 444 | "placement": "bottom", 445 | "showLegend": true, 446 | "sortBy": "Mean", 447 | "sortDesc": true 448 | }, 449 | "tooltip": { 450 | "mode": "single", 451 | "sort": "none" 452 | } 453 | }, 454 | "targets": [ 455 | { 456 | "datasource": { 457 | "type": "prometheus", 458 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 459 | }, 460 | "disableTextWrap": false, 461 | "editorMode": "code", 462 | "exemplar": false, 463 | "expr": "avg_over_time(meshtastic_telemetry_device_channel_utilization_percent{source_long_name=~\"$source\"}[$__interval])", 464 | "fullMetaSearch": false, 465 | "includeNullMetadata": true, 466 | "instant": false, 467 | "interval": "1m", 468 | "legendFormat": "{{source_long_name}} ({{source}})", 469 | "range": true, 470 | "refId": "A", 471 | "useBackend": false 472 | } 473 | ], 474 | "title": "Channel util", 475 | "type": "timeseries" 476 | }, 477 | { 478 | "datasource": { 479 | "type": "prometheus", 480 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 481 | }, 482 | "fieldConfig": { 483 | "defaults": { 484 | "color": { 485 | "mode": "palette-classic" 486 | }, 487 | "custom": { 488 | "axisBorderShow": false, 489 | "axisCenteredZero": false, 490 | "axisColorMode": "text", 491 | "axisLabel": "", 492 | "axisPlacement": "auto", 493 | "barAlignment": 0, 494 | "drawStyle": "line", 495 | "fillOpacity": 0, 496 | "gradientMode": "none", 497 | "hideFrom": { 498 | "legend": false, 499 | "tooltip": false, 500 | "viz": false 501 | }, 502 | "insertNulls": false, 503 | "lineInterpolation": "linear", 504 | "lineWidth": 1, 505 | "pointSize": 5, 506 | "scaleDistribution": { 507 | "type": "linear" 508 | }, 509 | "showPoints": "always", 510 | "spanNulls": true, 511 | "stacking": { 512 | "group": "A", 513 | "mode": "none" 514 | }, 515 | "thresholdsStyle": { 516 | "mode": "off" 517 | } 518 | }, 519 | "mappings": [], 520 | "thresholds": { 521 | "mode": "absolute", 522 | "steps": [ 523 | { 524 | "color": "green", 525 | "value": null 526 | }, 527 | { 528 | "color": "red", 529 | "value": 80 530 | } 531 | ] 532 | }, 533 | "unit": "percent" 534 | }, 535 | "overrides": [] 536 | }, 537 | "gridPos": { 538 | "h": 16, 539 | "w": 12, 540 | "x": 12, 541 | "y": 17 542 | }, 543 | "id": 10, 544 | "options": { 545 | "legend": { 546 | "calcs": [ 547 | "lastNotNull", 548 | "mean", 549 | "min", 550 | "max" 551 | ], 552 | "displayMode": "table", 553 | "placement": "bottom", 554 | "showLegend": true, 555 | "sortBy": "Mean", 556 | "sortDesc": true 557 | }, 558 | "tooltip": { 559 | "mode": "single", 560 | "sort": "none" 561 | } 562 | }, 563 | "targets": [ 564 | { 565 | "datasource": { 566 | "type": "prometheus", 567 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 568 | }, 569 | "disableTextWrap": false, 570 | "editorMode": "code", 571 | "expr": "avg_over_time(meshtastic_telemetry_device_air_util_tx_percent{source_long_name=~\"$source\"}[$__interval])", 572 | "format": "time_series", 573 | "fullMetaSearch": false, 574 | "includeNullMetadata": true, 575 | "instant": false, 576 | "interval": "1m", 577 | "legendFormat": "{{source_long_name}} ({{source}})", 578 | "range": true, 579 | "refId": "A", 580 | "useBackend": false 581 | } 582 | ], 583 | "title": "Air util tx", 584 | "type": "timeseries" 585 | }, 586 | { 587 | "datasource": { 588 | "type": "prometheus", 589 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 590 | }, 591 | "fieldConfig": { 592 | "defaults": { 593 | "color": { 594 | "mode": "palette-classic", 595 | "seriesBy": "last" 596 | }, 597 | "custom": { 598 | "axisBorderShow": false, 599 | "axisCenteredZero": false, 600 | "axisColorMode": "text", 601 | "axisLabel": "", 602 | "axisPlacement": "auto", 603 | "barAlignment": 0, 604 | "drawStyle": "line", 605 | "fillOpacity": 0, 606 | "gradientMode": "none", 607 | "hideFrom": { 608 | "legend": false, 609 | "tooltip": false, 610 | "viz": false 611 | }, 612 | "insertNulls": false, 613 | "lineInterpolation": "linear", 614 | "lineWidth": 1, 615 | "pointSize": 5, 616 | "scaleDistribution": { 617 | "type": "linear" 618 | }, 619 | "showPoints": "always", 620 | "spanNulls": true, 621 | "stacking": { 622 | "group": "A", 623 | "mode": "none" 624 | }, 625 | "thresholdsStyle": { 626 | "mode": "off" 627 | } 628 | }, 629 | "mappings": [], 630 | "thresholds": { 631 | "mode": "absolute", 632 | "steps": [ 633 | { 634 | "color": "dark-green", 635 | "value": null 636 | } 637 | ] 638 | }, 639 | "unit": "volt" 640 | }, 641 | "overrides": [] 642 | }, 643 | "gridPos": { 644 | "h": 9, 645 | "w": 12, 646 | "x": 0, 647 | "y": 33 648 | }, 649 | "id": 14, 650 | "options": { 651 | "legend": { 652 | "calcs": [ 653 | "lastNotNull" 654 | ], 655 | "displayMode": "table", 656 | "placement": "right", 657 | "showLegend": true, 658 | "sortBy": "Last *", 659 | "sortDesc": true 660 | }, 661 | "tooltip": { 662 | "mode": "single", 663 | "sort": "none" 664 | } 665 | }, 666 | "targets": [ 667 | { 668 | "datasource": { 669 | "type": "prometheus", 670 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 671 | }, 672 | "disableTextWrap": false, 673 | "editorMode": "code", 674 | "exemplar": false, 675 | "expr": "avg_over_time(meshtastic_telemetry_env_voltage_volts{source_long_name=~\"$source\"}[$__interval])", 676 | "fullMetaSearch": false, 677 | "includeNullMetadata": true, 678 | "instant": false, 679 | "interval": "1m", 680 | "legendFormat": "{{source_long_name}} ({{source}})", 681 | "range": true, 682 | "refId": "A", 683 | "useBackend": false 684 | } 685 | ], 686 | "title": "Environment Voltage", 687 | "type": "timeseries" 688 | }, 689 | { 690 | "datasource": { 691 | "type": "prometheus", 692 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 693 | }, 694 | "fieldConfig": { 695 | "defaults": { 696 | "color": { 697 | "mode": "palette-classic", 698 | "seriesBy": "last" 699 | }, 700 | "custom": { 701 | "axisBorderShow": false, 702 | "axisCenteredZero": false, 703 | "axisColorMode": "text", 704 | "axisLabel": "", 705 | "axisPlacement": "auto", 706 | "barAlignment": 0, 707 | "drawStyle": "line", 708 | "fillOpacity": 0, 709 | "gradientMode": "none", 710 | "hideFrom": { 711 | "legend": false, 712 | "tooltip": false, 713 | "viz": false 714 | }, 715 | "insertNulls": false, 716 | "lineInterpolation": "linear", 717 | "lineWidth": 1, 718 | "pointSize": 5, 719 | "scaleDistribution": { 720 | "type": "linear" 721 | }, 722 | "showPoints": "always", 723 | "spanNulls": true, 724 | "stacking": { 725 | "group": "A", 726 | "mode": "none" 727 | }, 728 | "thresholdsStyle": { 729 | "mode": "off" 730 | } 731 | }, 732 | "mappings": [], 733 | "thresholds": { 734 | "mode": "absolute", 735 | "steps": [ 736 | { 737 | "color": "dark-green", 738 | "value": null 739 | } 740 | ] 741 | }, 742 | "unit": "amp" 743 | }, 744 | "overrides": [] 745 | }, 746 | "gridPos": { 747 | "h": 9, 748 | "w": 12, 749 | "x": 12, 750 | "y": 33 751 | }, 752 | "id": 13, 753 | "options": { 754 | "legend": { 755 | "calcs": [ 756 | "lastNotNull" 757 | ], 758 | "displayMode": "table", 759 | "placement": "right", 760 | "showLegend": true, 761 | "sortBy": "Last *", 762 | "sortDesc": true 763 | }, 764 | "tooltip": { 765 | "mode": "single", 766 | "sort": "none" 767 | } 768 | }, 769 | "targets": [ 770 | { 771 | "datasource": { 772 | "type": "prometheus", 773 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 774 | }, 775 | "disableTextWrap": false, 776 | "editorMode": "code", 777 | "exemplar": false, 778 | "expr": "avg_over_time(meshtastic_telemetry_env_current_amperes{source_long_name=~\"$source\"}[$__interval])", 779 | "fullMetaSearch": false, 780 | "includeNullMetadata": true, 781 | "instant": false, 782 | "interval": "1m", 783 | "legendFormat": "{{source_long_name}} ({{source}})", 784 | "range": true, 785 | "refId": "A", 786 | "useBackend": false 787 | } 788 | ], 789 | "title": "Environment Current", 790 | "type": "timeseries" 791 | } 792 | ], 793 | "refresh": "30s", 794 | "schemaVersion": 39, 795 | "tags": [], 796 | "templating": { 797 | "list": [ 798 | { 799 | "current": { 800 | "selected": true, 801 | "text": [ 802 | "All" 803 | ], 804 | "value": [ 805 | "$__all" 806 | ] 807 | }, 808 | "datasource": { 809 | "type": "prometheus", 810 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 811 | }, 812 | "definition": "label_values(meshtastic_mesh_packets_total,source_long_name)", 813 | "hide": 0, 814 | "includeAll": true, 815 | "multi": true, 816 | "name": "source", 817 | "options": [], 818 | "query": { 819 | "qryType": 1, 820 | "query": "label_values(meshtastic_mesh_packets_total,source_long_name)", 821 | "refId": "PrometheusVariableQueryEditor-VariableQuery" 822 | }, 823 | "refresh": 1, 824 | "regex": "", 825 | "skipUrlSync": false, 826 | "sort": 5, 827 | "type": "query" 828 | } 829 | ] 830 | }, 831 | "time": { 832 | "from": "now-6h", 833 | "to": "now" 834 | }, 835 | "timepicker": {}, 836 | "timezone": "", 837 | "title": "Meshtastic Telemetry (Net)", 838 | "uid": "a7ca7097-db42-4515-8bea-d9d2b9d1b116", 839 | "version": 45, 840 | "weekStart": "" 841 | } -------------------------------------------------------------------------------- /grafana-dashboards/telemetry-nodes.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "label": "prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__elements": {}, 13 | "__requires": [ 14 | { 15 | "type": "panel", 16 | "id": "gauge", 17 | "name": "Gauge", 18 | "version": "" 19 | }, 20 | { 21 | "type": "grafana", 22 | "id": "grafana", 23 | "name": "Grafana", 24 | "version": "10.4.2" 25 | }, 26 | { 27 | "type": "datasource", 28 | "id": "prometheus", 29 | "name": "Prometheus", 30 | "version": "1.0.0" 31 | }, 32 | { 33 | "type": "panel", 34 | "id": "stat", 35 | "name": "Stat", 36 | "version": "" 37 | }, 38 | { 39 | "type": "panel", 40 | "id": "timeseries", 41 | "name": "Time series", 42 | "version": "" 43 | } 44 | ], 45 | "annotations": { 46 | "list": [ 47 | { 48 | "builtIn": 1, 49 | "datasource": { 50 | "type": "grafana", 51 | "uid": "-- Grafana --" 52 | }, 53 | "enable": true, 54 | "hide": true, 55 | "iconColor": "rgba(0, 211, 255, 1)", 56 | "name": "Annotations & Alerts", 57 | "type": "dashboard" 58 | } 59 | ] 60 | }, 61 | "editable": true, 62 | "fiscalYearStartMonth": 0, 63 | "graphTooltip": 0, 64 | "id": null, 65 | "links": [], 66 | "liveNow": false, 67 | "panels": [ 68 | { 69 | "datasource": { 70 | "type": "prometheus", 71 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 72 | }, 73 | "fieldConfig": { 74 | "defaults": { 75 | "color": { 76 | "mode": "thresholds" 77 | }, 78 | "mappings": [], 79 | "thresholds": { 80 | "mode": "absolute", 81 | "steps": [ 82 | { 83 | "color": "dark-red", 84 | "value": null 85 | }, 86 | { 87 | "color": "dark-yellow", 88 | "value": 20 89 | }, 90 | { 91 | "color": "dark-green", 92 | "value": 80 93 | } 94 | ] 95 | }, 96 | "unit": "percent" 97 | }, 98 | "overrides": [] 99 | }, 100 | "gridPos": { 101 | "h": 8, 102 | "w": 4, 103 | "x": 0, 104 | "y": 0 105 | }, 106 | "id": 1, 107 | "options": { 108 | "orientation": "auto", 109 | "reduceOptions": { 110 | "calcs": [ 111 | "lastNotNull" 112 | ], 113 | "fields": "", 114 | "values": false 115 | }, 116 | "showThresholdLabels": false, 117 | "showThresholdMarkers": true 118 | }, 119 | "pluginVersion": "10.4.2", 120 | "targets": [ 121 | { 122 | "datasource": { 123 | "type": "prometheus", 124 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 125 | }, 126 | "disableTextWrap": false, 127 | "editorMode": "builder", 128 | "expr": "meshtastic_telemetry_device_battery_level_percent{source_long_name=~\"$source\"}", 129 | "fullMetaSearch": false, 130 | "includeNullMetadata": true, 131 | "instant": false, 132 | "legendFormat": "{{source_long_name}} ({{source}})", 133 | "range": true, 134 | "refId": "A", 135 | "useBackend": false 136 | } 137 | ], 138 | "title": "Battery level", 139 | "type": "gauge" 140 | }, 141 | { 142 | "datasource": { 143 | "type": "prometheus", 144 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 145 | }, 146 | "fieldConfig": { 147 | "defaults": { 148 | "color": { 149 | "mode": "continuous-RdYlGr", 150 | "seriesBy": "max" 151 | }, 152 | "custom": { 153 | "axisCenteredZero": false, 154 | "axisColorMode": "text", 155 | "axisLabel": "", 156 | "axisPlacement": "auto", 157 | "axisSoftMin": 0, 158 | "barAlignment": 0, 159 | "drawStyle": "line", 160 | "fillOpacity": 10, 161 | "gradientMode": "none", 162 | "hideFrom": { 163 | "legend": false, 164 | "tooltip": false, 165 | "viz": false 166 | }, 167 | "insertNulls": false, 168 | "lineInterpolation": "smooth", 169 | "lineWidth": 1, 170 | "pointSize": 5, 171 | "scaleDistribution": { 172 | "type": "linear" 173 | }, 174 | "showPoints": "always", 175 | "spanNulls": true, 176 | "stacking": { 177 | "group": "A", 178 | "mode": "none" 179 | }, 180 | "thresholdsStyle": { 181 | "mode": "off" 182 | } 183 | }, 184 | "mappings": [], 185 | "max": 110, 186 | "min": 0, 187 | "thresholds": { 188 | "mode": "absolute", 189 | "steps": [ 190 | { 191 | "color": "green", 192 | "value": null 193 | } 194 | ] 195 | }, 196 | "unit": "percent" 197 | }, 198 | "overrides": [] 199 | }, 200 | "gridPos": { 201 | "h": 8, 202 | "w": 8, 203 | "x": 4, 204 | "y": 0 205 | }, 206 | "id": 5, 207 | "options": { 208 | "legend": { 209 | "calcs": [ 210 | "lastNotNull" 211 | ], 212 | "displayMode": "list", 213 | "placement": "bottom", 214 | "showLegend": true 215 | }, 216 | "tooltip": { 217 | "mode": "single", 218 | "sort": "none" 219 | } 220 | }, 221 | "targets": [ 222 | { 223 | "datasource": { 224 | "type": "prometheus", 225 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 226 | }, 227 | "disableTextWrap": false, 228 | "editorMode": "code", 229 | "exemplar": false, 230 | "expr": "avg_over_time(meshtastic_telemetry_device_battery_level_percent{source_long_name=~\"$source\"}[$__interval])", 231 | "format": "time_series", 232 | "fullMetaSearch": false, 233 | "includeNullMetadata": true, 234 | "instant": false, 235 | "interval": "1m", 236 | "legendFormat": "Battery level {{source_long_name}} ({{source}})", 237 | "range": true, 238 | "refId": "A", 239 | "useBackend": false 240 | } 241 | ], 242 | "title": "Battery level", 243 | "type": "timeseries" 244 | }, 245 | { 246 | "datasource": { 247 | "type": "prometheus", 248 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 249 | }, 250 | "fieldConfig": { 251 | "defaults": { 252 | "color": { 253 | "mode": "thresholds" 254 | }, 255 | "mappings": [], 256 | "thresholds": { 257 | "mode": "absolute", 258 | "steps": [ 259 | { 260 | "color": "green", 261 | "value": null 262 | }, 263 | { 264 | "color": "red", 265 | "value": 80 266 | } 267 | ] 268 | }, 269 | "unit": "volt" 270 | }, 271 | "overrides": [] 272 | }, 273 | "gridPos": { 274 | "h": 8, 275 | "w": 4, 276 | "x": 12, 277 | "y": 0 278 | }, 279 | "id": 2, 280 | "options": { 281 | "colorMode": "value", 282 | "graphMode": "area", 283 | "justifyMode": "auto", 284 | "orientation": "auto", 285 | "reduceOptions": { 286 | "calcs": [ 287 | "lastNotNull" 288 | ], 289 | "fields": "", 290 | "values": false 291 | }, 292 | "textMode": "auto" 293 | }, 294 | "pluginVersion": "10.4.2", 295 | "targets": [ 296 | { 297 | "datasource": { 298 | "type": "prometheus", 299 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 300 | }, 301 | "disableTextWrap": false, 302 | "editorMode": "builder", 303 | "expr": "meshtastic_telemetry_device_voltage_volts{source_long_name=~\"$source\"}", 304 | "fullMetaSearch": false, 305 | "includeNullMetadata": true, 306 | "instant": false, 307 | "interval": "1m", 308 | "legendFormat": "{{source_long_name}} ({{source}})", 309 | "range": true, 310 | "refId": "A", 311 | "useBackend": false 312 | } 313 | ], 314 | "title": "Device Voltage", 315 | "type": "stat" 316 | }, 317 | { 318 | "datasource": { 319 | "type": "prometheus", 320 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 321 | }, 322 | "fieldConfig": { 323 | "defaults": { 324 | "color": { 325 | "mode": "palette-classic" 326 | }, 327 | "custom": { 328 | "axisCenteredZero": false, 329 | "axisColorMode": "text", 330 | "axisLabel": "", 331 | "axisPlacement": "auto", 332 | "barAlignment": 0, 333 | "drawStyle": "line", 334 | "fillOpacity": 0, 335 | "gradientMode": "none", 336 | "hideFrom": { 337 | "legend": false, 338 | "tooltip": false, 339 | "viz": false 340 | }, 341 | "insertNulls": false, 342 | "lineInterpolation": "linear", 343 | "lineWidth": 1, 344 | "pointSize": 5, 345 | "scaleDistribution": { 346 | "type": "linear" 347 | }, 348 | "showPoints": "always", 349 | "spanNulls": true, 350 | "stacking": { 351 | "group": "A", 352 | "mode": "none" 353 | }, 354 | "thresholdsStyle": { 355 | "mode": "off" 356 | } 357 | }, 358 | "mappings": [], 359 | "thresholds": { 360 | "mode": "absolute", 361 | "steps": [ 362 | { 363 | "color": "green", 364 | "value": null 365 | }, 366 | { 367 | "color": "red", 368 | "value": 80 369 | } 370 | ] 371 | }, 372 | "unit": "celsius" 373 | }, 374 | "overrides": [] 375 | }, 376 | "gridPos": { 377 | "h": 8, 378 | "w": 4, 379 | "x": 16, 380 | "y": 0 381 | }, 382 | "id": 6, 383 | "options": { 384 | "legend": { 385 | "calcs": [ 386 | "lastNotNull" 387 | ], 388 | "displayMode": "list", 389 | "placement": "bottom", 390 | "showLegend": true 391 | }, 392 | "tooltip": { 393 | "mode": "single", 394 | "sort": "none" 395 | } 396 | }, 397 | "targets": [ 398 | { 399 | "datasource": { 400 | "type": "prometheus", 401 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 402 | }, 403 | "disableTextWrap": false, 404 | "editorMode": "code", 405 | "expr": "avg_over_time(meshtastic_telemetry_env_temperature_celsius{source_long_name=~\"$source\"}[$__interval])", 406 | "fullMetaSearch": false, 407 | "includeNullMetadata": true, 408 | "instant": false, 409 | "interval": "1m", 410 | "legendFormat": "Temperature {{source_long_name}} ({{source}})", 411 | "range": true, 412 | "refId": "A", 413 | "useBackend": false 414 | } 415 | ], 416 | "title": "Temperature", 417 | "type": "timeseries" 418 | }, 419 | { 420 | "datasource": { 421 | "type": "prometheus", 422 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 423 | }, 424 | "fieldConfig": { 425 | "defaults": { 426 | "color": { 427 | "mode": "palette-classic" 428 | }, 429 | "custom": { 430 | "axisCenteredZero": false, 431 | "axisColorMode": "text", 432 | "axisLabel": "", 433 | "axisPlacement": "auto", 434 | "barAlignment": 0, 435 | "drawStyle": "line", 436 | "fillOpacity": 0, 437 | "gradientMode": "none", 438 | "hideFrom": { 439 | "legend": false, 440 | "tooltip": false, 441 | "viz": false 442 | }, 443 | "insertNulls": false, 444 | "lineInterpolation": "linear", 445 | "lineWidth": 1, 446 | "pointSize": 5, 447 | "scaleDistribution": { 448 | "type": "linear" 449 | }, 450 | "showPoints": "always", 451 | "spanNulls": true, 452 | "stacking": { 453 | "group": "A", 454 | "mode": "none" 455 | }, 456 | "thresholdsStyle": { 457 | "mode": "off" 458 | } 459 | }, 460 | "decimals": 1, 461 | "mappings": [], 462 | "thresholds": { 463 | "mode": "absolute", 464 | "steps": [ 465 | { 466 | "color": "green", 467 | "value": null 468 | }, 469 | { 470 | "color": "red", 471 | "value": 80 472 | } 473 | ] 474 | }, 475 | "unit": "mmHg" 476 | }, 477 | "overrides": [] 478 | }, 479 | "gridPos": { 480 | "h": 8, 481 | "w": 4, 482 | "x": 20, 483 | "y": 0 484 | }, 485 | "id": 8, 486 | "options": { 487 | "legend": { 488 | "calcs": [ 489 | "lastNotNull" 490 | ], 491 | "displayMode": "list", 492 | "placement": "bottom", 493 | "showLegend": true 494 | }, 495 | "tooltip": { 496 | "mode": "single", 497 | "sort": "none" 498 | } 499 | }, 500 | "targets": [ 501 | { 502 | "datasource": { 503 | "type": "prometheus", 504 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 505 | }, 506 | "disableTextWrap": false, 507 | "editorMode": "code", 508 | "expr": "avg_over_time(meshtastic_telemetry_env_barometric_pressure_pascal {source_long_name=~\"$source\"}[$__interval]) / 133.3", 509 | "fullMetaSearch": false, 510 | "includeNullMetadata": true, 511 | "instant": false, 512 | "interval": "1m", 513 | "legendFormat": "Barometric pressure {{source_long_name}} ({{source}})", 514 | "range": true, 515 | "refId": "A", 516 | "useBackend": false 517 | } 518 | ], 519 | "title": "Barometric pressure", 520 | "type": "timeseries" 521 | }, 522 | { 523 | "datasource": { 524 | "type": "prometheus", 525 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 526 | }, 527 | "fieldConfig": { 528 | "defaults": { 529 | "color": { 530 | "mode": "palette-classic" 531 | }, 532 | "custom": { 533 | "axisCenteredZero": false, 534 | "axisColorMode": "text", 535 | "axisLabel": "", 536 | "axisPlacement": "auto", 537 | "barAlignment": 0, 538 | "drawStyle": "line", 539 | "fillOpacity": 0, 540 | "gradientMode": "none", 541 | "hideFrom": { 542 | "legend": false, 543 | "tooltip": false, 544 | "viz": false 545 | }, 546 | "insertNulls": false, 547 | "lineInterpolation": "linear", 548 | "lineWidth": 1, 549 | "pointSize": 5, 550 | "scaleDistribution": { 551 | "type": "linear" 552 | }, 553 | "showPoints": "always", 554 | "spanNulls": true, 555 | "stacking": { 556 | "group": "A", 557 | "mode": "none" 558 | }, 559 | "thresholdsStyle": { 560 | "mode": "off" 561 | } 562 | }, 563 | "mappings": [], 564 | "thresholds": { 565 | "mode": "absolute", 566 | "steps": [ 567 | { 568 | "color": "green", 569 | "value": null 570 | }, 571 | { 572 | "color": "red", 573 | "value": 80 574 | } 575 | ] 576 | }, 577 | "unit": "volt" 578 | }, 579 | "overrides": [] 580 | }, 581 | "gridPos": { 582 | "h": 8, 583 | "w": 12, 584 | "x": 0, 585 | "y": 8 586 | }, 587 | "id": 11, 588 | "options": { 589 | "legend": { 590 | "calcs": [ 591 | "lastNotNull" 592 | ], 593 | "displayMode": "list", 594 | "placement": "bottom", 595 | "showLegend": true 596 | }, 597 | "tooltip": { 598 | "mode": "single", 599 | "sort": "none" 600 | } 601 | }, 602 | "targets": [ 603 | { 604 | "datasource": { 605 | "type": "prometheus", 606 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 607 | }, 608 | "disableTextWrap": false, 609 | "editorMode": "code", 610 | "expr": "avg_over_time(meshtastic_telemetry_env_voltage_volts{source_long_name=~\"$source\"}[$__interval])", 611 | "fullMetaSearch": false, 612 | "includeNullMetadata": true, 613 | "instant": false, 614 | "interval": "1m", 615 | "legendFormat": "Environment Voltage {{source_long_name}} ({{source}})", 616 | "range": true, 617 | "refId": "A", 618 | "useBackend": false 619 | } 620 | ], 621 | "title": "Environment Voltage", 622 | "type": "timeseries" 623 | }, 624 | { 625 | "datasource": { 626 | "type": "prometheus", 627 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 628 | }, 629 | "fieldConfig": { 630 | "defaults": { 631 | "color": { 632 | "mode": "palette-classic" 633 | }, 634 | "custom": { 635 | "axisCenteredZero": false, 636 | "axisColorMode": "text", 637 | "axisLabel": "", 638 | "axisPlacement": "auto", 639 | "barAlignment": 0, 640 | "drawStyle": "line", 641 | "fillOpacity": 0, 642 | "gradientMode": "none", 643 | "hideFrom": { 644 | "legend": false, 645 | "tooltip": false, 646 | "viz": false 647 | }, 648 | "insertNulls": false, 649 | "lineInterpolation": "linear", 650 | "lineWidth": 1, 651 | "pointSize": 5, 652 | "scaleDistribution": { 653 | "type": "linear" 654 | }, 655 | "showPoints": "always", 656 | "spanNulls": true, 657 | "stacking": { 658 | "group": "A", 659 | "mode": "none" 660 | }, 661 | "thresholdsStyle": { 662 | "mode": "off" 663 | } 664 | }, 665 | "mappings": [], 666 | "thresholds": { 667 | "mode": "absolute", 668 | "steps": [ 669 | { 670 | "color": "green", 671 | "value": null 672 | }, 673 | { 674 | "color": "red", 675 | "value": 80 676 | } 677 | ] 678 | }, 679 | "unit": "amp" 680 | }, 681 | "overrides": [] 682 | }, 683 | "gridPos": { 684 | "h": 8, 685 | "w": 12, 686 | "x": 12, 687 | "y": 8 688 | }, 689 | "id": 12, 690 | "options": { 691 | "legend": { 692 | "calcs": [ 693 | "lastNotNull" 694 | ], 695 | "displayMode": "list", 696 | "placement": "bottom", 697 | "showLegend": true 698 | }, 699 | "tooltip": { 700 | "mode": "single", 701 | "sort": "none" 702 | } 703 | }, 704 | "targets": [ 705 | { 706 | "datasource": { 707 | "type": "prometheus", 708 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 709 | }, 710 | "disableTextWrap": false, 711 | "editorMode": "code", 712 | "expr": "avg_over_time(meshtastic_telemetry_env_current_amperes{source_long_name=~\"$source\"}[$__interval])", 713 | "fullMetaSearch": false, 714 | "includeNullMetadata": true, 715 | "instant": false, 716 | "interval": "1m", 717 | "legendFormat": "Environment Current {{source_long_name}} ({{source}})", 718 | "range": true, 719 | "refId": "A", 720 | "useBackend": false 721 | } 722 | ], 723 | "title": "Environment Current", 724 | "type": "timeseries" 725 | }, 726 | { 727 | "datasource": { 728 | "type": "prometheus", 729 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 730 | }, 731 | "fieldConfig": { 732 | "defaults": { 733 | "color": { 734 | "mode": "palette-classic" 735 | }, 736 | "custom": { 737 | "axisCenteredZero": false, 738 | "axisColorMode": "text", 739 | "axisLabel": "", 740 | "axisPlacement": "auto", 741 | "barAlignment": 0, 742 | "drawStyle": "line", 743 | "fillOpacity": 0, 744 | "gradientMode": "none", 745 | "hideFrom": { 746 | "legend": false, 747 | "tooltip": false, 748 | "viz": false 749 | }, 750 | "insertNulls": false, 751 | "lineInterpolation": "linear", 752 | "lineWidth": 1, 753 | "pointSize": 5, 754 | "scaleDistribution": { 755 | "type": "linear" 756 | }, 757 | "showPoints": "always", 758 | "spanNulls": true, 759 | "stacking": { 760 | "group": "A", 761 | "mode": "none" 762 | }, 763 | "thresholdsStyle": { 764 | "mode": "off" 765 | } 766 | }, 767 | "mappings": [], 768 | "thresholds": { 769 | "mode": "absolute", 770 | "steps": [ 771 | { 772 | "color": "green", 773 | "value": null 774 | }, 775 | { 776 | "color": "red", 777 | "value": 80 778 | } 779 | ] 780 | }, 781 | "unit": "percent" 782 | }, 783 | "overrides": [] 784 | }, 785 | "gridPos": { 786 | "h": 8, 787 | "w": 12, 788 | "x": 0, 789 | "y": 16 790 | }, 791 | "id": 9, 792 | "options": { 793 | "legend": { 794 | "calcs": [ 795 | "lastNotNull" 796 | ], 797 | "displayMode": "list", 798 | "placement": "bottom", 799 | "showLegend": true 800 | }, 801 | "tooltip": { 802 | "mode": "single", 803 | "sort": "none" 804 | } 805 | }, 806 | "targets": [ 807 | { 808 | "datasource": { 809 | "type": "prometheus", 810 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 811 | }, 812 | "disableTextWrap": false, 813 | "editorMode": "code", 814 | "expr": "avg_over_time(meshtastic_telemetry_device_channel_utilization_percent{source_long_name=~\"$source\"}[$__interval])", 815 | "fullMetaSearch": false, 816 | "includeNullMetadata": true, 817 | "instant": false, 818 | "interval": "1m", 819 | "legendFormat": "Channel util {{source_long_name}} ({{source}})", 820 | "range": true, 821 | "refId": "A", 822 | "useBackend": false 823 | } 824 | ], 825 | "title": "Channel util", 826 | "type": "timeseries" 827 | }, 828 | { 829 | "datasource": { 830 | "type": "prometheus", 831 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 832 | }, 833 | "fieldConfig": { 834 | "defaults": { 835 | "color": { 836 | "mode": "palette-classic" 837 | }, 838 | "custom": { 839 | "axisCenteredZero": false, 840 | "axisColorMode": "text", 841 | "axisLabel": "", 842 | "axisPlacement": "auto", 843 | "barAlignment": 0, 844 | "drawStyle": "line", 845 | "fillOpacity": 0, 846 | "gradientMode": "none", 847 | "hideFrom": { 848 | "legend": false, 849 | "tooltip": false, 850 | "viz": false 851 | }, 852 | "insertNulls": false, 853 | "lineInterpolation": "linear", 854 | "lineWidth": 1, 855 | "pointSize": 5, 856 | "scaleDistribution": { 857 | "type": "linear" 858 | }, 859 | "showPoints": "always", 860 | "spanNulls": true, 861 | "stacking": { 862 | "group": "A", 863 | "mode": "none" 864 | }, 865 | "thresholdsStyle": { 866 | "mode": "off" 867 | } 868 | }, 869 | "mappings": [], 870 | "thresholds": { 871 | "mode": "absolute", 872 | "steps": [ 873 | { 874 | "color": "green", 875 | "value": null 876 | }, 877 | { 878 | "color": "red", 879 | "value": 80 880 | } 881 | ] 882 | }, 883 | "unit": "percent" 884 | }, 885 | "overrides": [] 886 | }, 887 | "gridPos": { 888 | "h": 8, 889 | "w": 12, 890 | "x": 12, 891 | "y": 16 892 | }, 893 | "id": 10, 894 | "options": { 895 | "legend": { 896 | "calcs": [ 897 | "lastNotNull" 898 | ], 899 | "displayMode": "list", 900 | "placement": "bottom", 901 | "showLegend": true 902 | }, 903 | "tooltip": { 904 | "mode": "single", 905 | "sort": "none" 906 | } 907 | }, 908 | "targets": [ 909 | { 910 | "datasource": { 911 | "type": "prometheus", 912 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 913 | }, 914 | "disableTextWrap": false, 915 | "editorMode": "code", 916 | "expr": "avg_over_time(meshtastic_telemetry_device_air_util_tx_percent{source_long_name=~\"$source\"}[$__interval])", 917 | "fullMetaSearch": false, 918 | "includeNullMetadata": true, 919 | "instant": false, 920 | "interval": "1m", 921 | "legendFormat": "Air util tx {{source_long_name}} ({{source}})", 922 | "range": true, 923 | "refId": "A", 924 | "useBackend": false 925 | } 926 | ], 927 | "title": "Air util tx", 928 | "type": "timeseries" 929 | } 930 | ], 931 | "refresh": "30s", 932 | "schemaVersion": 38, 933 | "style": "dark", 934 | "tags": [], 935 | "templating": { 936 | "list": [ 937 | { 938 | "current": {}, 939 | "datasource": { 940 | "type": "prometheus", 941 | "uid": "a7ee7fd2-ee1a-4400-b169-afa1f8c619ed" 942 | }, 943 | "definition": "label_values(meshtastic_mesh_packets_total,source_long_name)", 944 | "hide": 0, 945 | "includeAll": false, 946 | "multi": true, 947 | "name": "source", 948 | "options": [], 949 | "query": { 950 | "qryType": 1, 951 | "query": "label_values(meshtastic_mesh_packets_total,source_long_name)", 952 | "refId": "PrometheusVariableQueryEditor-VariableQuery" 953 | }, 954 | "refresh": 1, 955 | "regex": "", 956 | "skipUrlSync": false, 957 | "sort": 5, 958 | "type": "query" 959 | } 960 | ] 961 | }, 962 | "time": { 963 | "from": "now-6h", 964 | "to": "now" 965 | }, 966 | "timepicker": {}, 967 | "timezone": "", 968 | "title": "Meshtastic Telemetry (Nodes)", 969 | "uid": "a7ca7097-db42-4515-8bea-d9d2b9d1b117", 970 | "version": 22, 971 | "weekStart": "" 972 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------