Running TTN Prometheus Exporter as systemd Service

Background In previous posts we presented a Prometheus exporter to monitor for monitoring TheThingsNetwork gateways. The exporter can directly be executed in a terminal. However, to use it productively it should run in the background as a service. This article demonstrates how this can be achieved using the system and service manager systemd on Linux systems. Preparation The first step is to prepare the environment where the Prometheus exporter is installed. Throughout this article we will use the directory /usr/local/bin/prometheus-ttn-exporter. However, any other directory in the local file system is also possible. ...

February 15, 2022 · 2 min

The Things Stack Gateway Monitoring

Background In previous posts we showed how the status of TheThingsNetwork gatways can be monitored. With the switch of the underlying infrastructure to TheThingsStack this becomes even easier, because the API allows direct access to the relevant statistics of the gateways. It is now also possible to authenticate with a (personal) API key, such that the login procedure becomes also easier to handle. API Key The first step is to create an API key with the appropriate permissions. This can be done in the console of TheThingsNetwork, by clicking on your username in the upper right corner and selecting the option Personal API Keys. You have to create a token with at least the permissions view gateway status and list gateways the user is a collaborator of. ...

February 10, 2022 · 2 min

Improved TheThingsNetwork Gateway Monitoring

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

December 28, 2020 · 2 min

TheThingsNetwork Gateway Monitoring

Background In a previous post we showed how to setup a new TheThingsNetwork gateway. After successfully building a gateway and connecting it to TTN, probably one of the most interesting information for gateway operators is how frequently the gateway is used. This information is available on the TheThingsNetwork Console, but of course we want to access this data via API so that we can use it in multiple ways. One option would be to create a Grafana dashboard and display the transmitted and received messages. TTN provides a public API, but there the interesting information is not included. ...

December 16, 2020 · 5 min