mirror of
https://github.com/tcivie/meshtastic-metrics-exporter.git
synced 2025-03-05 20:52:02 -08:00
Compare commits
No commits in common. "ecb19a47351903db6dd680a6bb65d749efa811f5" and "5183ade98b7acad72b93977b14bc682a7bf23ca6" have entirely different histories.
ecb19a4735
...
5183ade98b
|
@ -9,6 +9,5 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="PackageRequirementsSettings">
|
<component name="PackageRequirementsSettings">
|
||||||
<option name="versionSpecifier" value="Greater or equal (>=x.y.z)" />
|
<option name="versionSpecifier" value="Greater or equal (>=x.y.z)" />
|
||||||
<option name="keepMatchingSpecifier" value="false" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -192,9 +192,6 @@ Label Notation:
|
||||||
| mesh_packet_ids | Unique packet IDs | Counter | 🏷️ (source), 🏷️ (destination), packet_id |
|
| mesh_packet_ids | Unique packet IDs | Counter | 🏷️ (source), 🏷️ (destination), packet_id |
|
||||||
| mesh_packet_channel | Packet channel | Counter | 🏷️ (source), 🏷️ (destination), channel |
|
| mesh_packet_channel | Packet channel | Counter | 🏷️ (source), 🏷️ (destination), channel |
|
||||||
| mesh_packet_rx_rssi | Packet receive RSSI | Gauge | 🏷️ (source), 🏷️ (destination) |
|
| mesh_packet_rx_rssi | Packet receive RSSI | Gauge | 🏷️ (source), 🏷️ (destination) |
|
||||||
| pax_wifi | Number of Wifi devices (PAX) | Gauge | 🏷 |
|
|
||||||
| pax_ble | Number of Bluetooth devices (PAX) | Gauge | 🏷 |
|
|
||||||
| pax_uptime | PAX device uptime | Gauge | 🏷 |
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from prometheus_client import CollectorRegistry, Counter, Gauge
|
from prometheus_client import CollectorRegistry, Counter, Gauge
|
||||||
|
|
||||||
from exporter.client_details import ClientDetails
|
from exporter.client_details import ClientDetails
|
||||||
|
@ -36,7 +35,6 @@ class Metrics:
|
||||||
self._init_metrics_telemetry_air_quality()
|
self._init_metrics_telemetry_air_quality()
|
||||||
self._init_metrics_telemetry_power()
|
self._init_metrics_telemetry_power()
|
||||||
self._init_route_discovery_metrics()
|
self._init_route_discovery_metrics()
|
||||||
self._init_pax_counter_metrics()
|
|
||||||
|
|
||||||
def update_metrics_position(self, latitude, longitude, altitude, precision, client_details: ClientDetails):
|
def update_metrics_position(self, latitude, longitude, altitude, precision, client_details: ClientDetails):
|
||||||
# Could be used to calculate more complex data (Like distances etc..)
|
# Could be used to calculate more complex data (Like distances etc..)
|
||||||
|
@ -330,23 +328,3 @@ class Metrics:
|
||||||
self._get_common_labels() + ['response_type'],
|
self._get_common_labels() + ['response_type'],
|
||||||
registry=self._registry
|
registry=self._registry
|
||||||
)
|
)
|
||||||
|
|
||||||
def _init_pax_counter_metrics(self):
|
|
||||||
self.pax_wifi_gauge = Gauge(
|
|
||||||
'pax_wifi',
|
|
||||||
'Number of WiFi devices',
|
|
||||||
self._get_common_labels(),
|
|
||||||
registry=self._registry
|
|
||||||
)
|
|
||||||
self.pax_ble_gauge = Gauge(
|
|
||||||
'pax_ble',
|
|
||||||
'Number of BLE devices',
|
|
||||||
self._get_common_labels(),
|
|
||||||
registry=self._registry
|
|
||||||
)
|
|
||||||
self.pax_uptime_gauge = Gauge(
|
|
||||||
'pax_uptime',
|
|
||||||
'Uptime of the device',
|
|
||||||
self._get_common_labels(),
|
|
||||||
registry=self._registry
|
|
||||||
)
|
|
||||||
|
|
|
@ -5,17 +5,16 @@ import sys
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||||
|
from meshtastic.protobuf.mqtt_pb2 import ServiceEnvelope
|
||||||
|
|
||||||
from exporter.metric.node_configuration_metrics import NodeConfigurationMetrics
|
from exporter.metric.node_configuration_metrics import NodeConfigurationMetrics
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from meshtastic.mesh_pb2 import MeshPacket, Data, HardwareModel
|
from meshtastic.mesh_pb2 import MeshPacket, Data, HardwareModel
|
||||||
from meshtastic.portnums_pb2 import PortNum
|
from meshtastic.portnums_pb2 import PortNum
|
||||||
from meshtastic.mqtt_pb2 import ServiceEnvelope
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from meshtastic.protobuf.mesh_pb2 import MeshPacket, Data, HardwareModel
|
from meshtastic.protobuf.mesh_pb2 import MeshPacket, Data, HardwareModel
|
||||||
from meshtastic.protobuf.portnums_pb2 import PortNum
|
from meshtastic.protobuf.portnums_pb2 import PortNum
|
||||||
from meshtastic.protobuf.mqtt_pb2 import ServiceEnvelope
|
|
||||||
|
|
||||||
from prometheus_client import CollectorRegistry, Counter, Gauge
|
from prometheus_client import CollectorRegistry, Counter, Gauge
|
||||||
from psycopg_pool import ConnectionPool
|
from psycopg_pool import ConnectionPool
|
||||||
|
|
|
@ -267,16 +267,6 @@ class PaxCounterAppProcessor(Processor):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to parse PAXCOUNTER_APP packet: {e}")
|
logger.error(f"Failed to parse PAXCOUNTER_APP packet: {e}")
|
||||||
return
|
return
|
||||||
self.metrics.pax_wifi_gauge.labels(
|
|
||||||
**client_details.to_dict()
|
|
||||||
).set(paxcounter.wifi)
|
|
||||||
self.metrics.pax_ble_gauge.labels(
|
|
||||||
**client_details.to_dict()
|
|
||||||
).set(paxcounter.ble)
|
|
||||||
self.metrics.pax_uptime_gauge.labels(
|
|
||||||
**client_details.to_dict()
|
|
||||||
).set(paxcounter.uptime)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ProcessorRegistry.register_processor(PortNum.SERIAL_APP)
|
@ProcessorRegistry.register_processor(PortNum.SERIAL_APP)
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
paho-mqtt>=2.1.0
|
paho-mqtt~=2.1.0
|
||||||
python-dotenv>=1.0.1
|
python-dotenv~=1.0.1
|
||||||
prometheus_client>=0.21.1
|
prometheus_client~=0.20.0
|
||||||
unishox2-py3~=1.0.0
|
unishox2-py3~=1.0.0
|
||||||
cryptography>=44.0.1
|
cryptography~=42.0.8
|
||||||
psycopg>=3.2.5
|
psycopg~=3.1.19
|
||||||
psycopg_pool~=3.2.2
|
psycopg_pool~=3.2.2
|
||||||
psycopg-binary>=3.2.5
|
meshtastic~=2.3.13
|
||||||
|
psycopg-binary~=3.1.20
|
||||||
geopy>=2.4.1
|
geopy>=2.4.1
|
||||||
psycopg-pool>=3.2.5
|
psycopg-pool>=3.2.2
|
||||||
APScheduler>=3.11.0
|
APScheduler>=3.10.4
|
||||||
|
|
||||||
# Meshtastic Protocol Buffers
|
|
||||||
meshtastic-protobufs-protocolbuffers-python==29.3.0.1.20241006120827+cc36fd21e859
|
|
||||||
--extra-index-url https://buf.build/gen/python
|
|
Loading…
Reference in a new issue