Ideetron / Larank

Software for the Larank product range.
GNU General Public License v3.0
15 stars 12 forks source link

Providing a way to get the current metrics #11

Closed francisdb closed 7 years ago

francisdb commented 7 years ago

Currently the gateway metrics are periodically logged. We would like to send this to a metrics/timeseries aggregation/monitoring platform.

Any of these would help:

sillevl commented 7 years ago

I have been wondering the same. In a spare moment, I started a project to make an alternative web interface (using a responsive framework Foundation). I planned to work with a json api to get access to all metrics, this to enable other services to get access to the metrics.

I thought the lorankctl can be called to get all the metrics that are displayed on the webpage. It would be possible to make a service or cronjob to query these metrics and put them in a kind of database or file.

I don't know if the format of the current logger functionality can be used to parse metrics. Although this might not be an effective and efficient manner to get this kind information.

At first, I wanted to adapt the current web interface, but it is not designed so that these functionalities could be added or changed easily.

devlaam commented 7 years ago

The poly_forwarder collects more metrics than the Semtech forwarder, but more important, it exports all of them. Export is done in three ways.

First, every 30 sec (per default, configurable via global_conf.json) a json file stats.txt is generated with a fixed format, containing all info that is collected. This file is currently used to produce the statistics on the Stats tab of the web page. Just like the website does, so you can use the bonescript call on lorankctl to retrieve that information as json. But there are other ways of course to periodically read the file, for example, just define a rsync in a cron job on an other machine, or make it part of a separate webpage.

Second, a version of the stats file is send periodically to the backend over UDP. Which format is used can be configured on the Admin page. Choices are: Semtech, Ideetron concise, Ideetron verbose. What to choose depends on how much you trust you put in your cloud provider. If he has a service where you can access this information, you do not need short range access to your Lorank.

Third, a condensed version of the information is written to /var/log/syslog periodically. However, periodically parsing this file does not seems the most efficient way to obtain the information.

francisdb commented 7 years ago

For my part this is enough, thanks @sillevl feel free to re-open if you need something else