cordelster / mesh-metrics

Script to pull prometheus node_exporter style metrics for Meshtastic repeater nodes.
BSD 3-Clause "New" or "Revised" License
11 stars 0 forks source link

mesh_metrics.sh

Description

This script allows interfacing directly with a Meshtastic node to poll repeaters for their status over the mesh network. It only requires a computer setup with Prometheus or Victoria Metrics, node_exporter (at this time), and a serial connection to a Meshtastic radio. It has no requirment for internet access.

Meshtastic dashboard

Buy Me a Coffee at ko-fi.com

Requirements:

How to use

-f </path/devfile.lst> Device list

-d </path/to/node_exporter/folder>

-i Create individual metrics file per node.

-m [serial | ip] Interface mode.

-p /dev/tyy.usbmodem[0-9] | <Host/IP>

-v Output verbose debug info

-P Password to decrypt your openssl encrpted device list.

NOTE: Arguments required are -f <path/device.lst> -p

With no output directory defined, the script prints to stdout on the screen.

./mesh-metrics.sh -f dev.lst -p /dev/tty.usbmodem0

Example using network:

./mesh-metrics.sh -f dev.lst -p 192.168.1.21 -m ip

Device file

Device file options: Only the NodeID is required to pole nodes though all the commas need to be represented on each line. All other fields are optional, though GPS coordinates are needed for the dashboard map to post points.

NODE ID CONTACT PROPERTY NAME LATITUDE LONGITUDE
!2f67c123 Jon Derps Derp Hill 21.1234 -122.56789
!2c4354f4 Dan Mann The man hill 21.254554 -122.56123

!2f67c123,Jon Derps,Derp Hill,21.1234,-122.56789

!2c4354f4,Dan Mann,The man hill,21.254554,-122.56123

!56a58b6a,,,,

Use

Run via a CRON job at an interval suitable for your network. The larger the network, the dwell time should be increased to keep channel utilization values realistic and not lose metrics.

Grafana

The Dashboard geomap plugin can change the point color to red for alerting nodes which requires Prometheus alertmanager to be installed and configured. This requirement is a limitation of the geomap plugin and grafana not having any means to otherwise relay that data, or it's intirely possibile I just have not found how to get that alert data from Grafana into the Geomap plugin... (I'm still searching to reduce any extra dependancies).

TODO: