In a previous post we showed how TTN gateways can be monitored using Prometheus. However, the presented solution had some limitations. For example it was only possible to monitor a single gateway. Also the code is now available on GitHub.
To support multiple gateways the output format has slightly be changed. The metrics for the different gateways can now be filtered by the label gateway_id.
# HELP python_gc_objects_collected_total Objects collected during gc # TYPE python_gc_objects_collected_total counter python_gc_objects_collected_total{generation="0"} 48.0 python_gc_objects_collected_total{generation="1"} 344.0 python_gc_objects_collected_total{generation="2"} 0.0 # HELP python_gc_objects_uncollectable_total Uncollectable object found during GC # TYPE python_gc_objects_uncollectable_total counter python_gc_objects_uncollectable_total{generation="0"} 0.0 python_gc_objects_uncollectable_total{generation="1"} 0.0 python_gc_objects_uncollectable_total{generation="2"} 0.0 # HELP python_gc_collections_total Number of times this generation was collected # TYPE python_gc_collections_total counter python_gc_collections_total{generation="0"} 59.0 python_gc_collections_total{generation="1"} 5.0 python_gc_collections_total{generation="2"} 0.0 # HELP python_info Python platform information # TYPE python_info gauge python_info{implementation="CPython",major="3",minor="9",patchlevel="1",version="3.9.1"} 1.0 # HELP process_virtual_memory_bytes Virtual memory size in bytes. # TYPE process_virtual_memory_bytes gauge process_virtual_memory_bytes 1.87236352e+08 # HELP process_resident_memory_bytes Resident memory size in bytes. # TYPE process_resident_memory_bytes gauge process_resident_memory_bytes 3.1379456e+07 # HELP process_start_time_seconds Start time of the process since unix epoch in seconds. # TYPE process_start_time_seconds gauge process_start_time_seconds 1.60917394427e+09 # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter process_cpu_seconds_total 0.13999999999999999 # HELP process_open_fds Number of open file descriptors. # TYPE process_open_fds gauge process_open_fds 8.0 # HELP process_max_fds Maximum number of open file descriptors. # TYPE process_max_fds gauge process_max_fds 1024.0 # HELP ttn_gateway_messages_uplink Number of uplink messages # TYPE ttn_gateway_messages_uplink gauge ttn_gateway_messages_uplink{gateway_id="eui-1"} 10.0 ttn_gateway_messages_uplink{gateway_id="eui-2"} 20.0 # HELP ttn_gateway_messages_downlink Number of downlink messages # TYPE ttn_gateway_messages_downlink gauge ttn_gateway_messages_downlink{gateway_id="eui-1"} 1.0 ttn_gateway_messages_downlink{gateway_id="eui-2"} 2.0 # HELP ttn_gateway_messages_rx_ok Number of rx_ok messages # TYPE ttn_gateway_messages_rx_ok gauge ttn_gateway_messages_rx_ok{gateway_id="eui-1"} 10.0 ttn_gateway_messages_rx_ok{gateway_id="eui-2"} 20.0 # HELP ttn_gateway_messages_tx_in Number of tx_in messages # TYPE ttn_gateway_messages_tx_in gauge ttn_gateway_messages_tx_in{gateway_id="eui-1"} 1.0 ttn_gateway_messages_tx_in{gateway_id="eui-02c10afffe41d2a3"} 2.0