Monitorix icon indicating copy to clipboard operation
Monitorix copied to clipboard

Request: JSON API

Open mostafahussein opened this issue 9 years ago • 8 comments

Is there any plans for making a JSON API ?

mostafahussein avatar Aug 09 '15 00:08 mostafahussein

A JSON API? what part of Monitorix do you think you need an API?

mikaku avatar Aug 10 '15 14:08 mikaku

This could help if you would like to import data related to your server in a custom chart or generating a report etc.. It would be helpful if there is such a feature in Monitorix

mostafahussein avatar Aug 13 '15 07:08 mostafahussein

I still don't see the goal here, sorry, since it's Monitorix who actually collects the statistical data directly from the system.

mikaku avatar Aug 13 '15 11:08 mikaku

I'd suggest at least taking this into consideration, as it would allow a greater ability to extend and customize Monitorix, and easily build a centralized status board for those, like us, monitoring multiple servers.

One possible approach could be to decouple the sensors (the actual measurement) from the action (updating RRDtool databases), allowing different triggers: one being the current database update, and other to HTTP POST the measured values to a preconfigured centralized URI.

That URI would fetch the received values, being up to the sysadmin what to do with them, thus conforming an elemental, yet functional extending mechanism. I would receive those values and use them to update a RRDtool database too, but on the centralized server instead than on each host, which I'd lately use to plot custom charts for my network, like all the mail queues on a single chart, which makes full sense for many use cases.

This kind of hooks would even allow to integrate Monitorix with third-party apps such as Slack (team chat), Pushover (notifications on mobile devices) and so on...

Just an idea.

JaimeObregon avatar Aug 24 '15 18:08 JaimeObregon

A possible low-quality workaround for this is basically to expose the .rrd files to Monitorix' built-in web server, then fetching them via HTTP from the third party service and consuming the data with rrdtool. It's far from perfect, but it enabled me to build a centralized dashboard for multihost monitoring: https://github.com/JaimeObregon/monitorix-board

screenshot

JaimeObregon avatar Aug 26 '15 17:08 JaimeObregon

Well ... exporting data, of course, is a new option. I thought sh3llsh0ck was talking on importing data to Monitorix which indeed it doesn't makes any sense to me.

In the other hand, I don't think Monitorix should connect to an external URL to leave the exported data there since it would be exposed to connection failures. I mean, I think this is not a job for a daemon. Instead, it would be better if it's the client who actually connects to the Monitorix built-in HTTP daemon (using a special URL) and fetches the exported data offered in different formats (CSV, JSON, etc.).

Anyway, although this is not a bad idea after all, I think that there are other OSS projects better suited for this like collectd at https://github.com/collectd/collectd.

Regarding the Dashboard idea, I think that it would be good to have a modern Multihost interface (besides the classical view). I've in my TODO list a number of good ideas waiting to see the light when I start reimplementing the new Multihost feature.

mikaku avatar Aug 29 '15 10:08 mikaku

HI!

Any updates on this issue? It would be great to be able query sensors via API. This will make HomeAssistant and other third-party solutions integration possible.

goooroooX avatar Apr 06 '21 15:04 goooroooX

Any updates on this issue?

No yet, but this idea comes to my mind very often recently. I've never created a JSON API, so I need to investigate further on how to do this.

It indeed would be a great feature.

mikaku avatar Apr 08 '21 14:04 mikaku