Article
· Feb 25, 2019 4m read

Using Grafana directly from IRIS

There have been some very helpful articles in the community that show how to use Grafana with IRIS (or Cache/Ensemble) by using an intermediate database.

But I wanted to get at IRIS structures directly. In particular, i wanted to access the Cache History monitor data that is accessible by SQL as described here

https://community.intersystems.com/post/apm-using-cach%C3%A9-history-mon...

and didn't want anything between me and the data.

I already had class queries that returned the data i wanted, so i just needed to embed them in a REST class that returned JSON. I haven't included my class Grafana.MonitorData because it could be anything but i can if people want it.

There were only two difficult points. One was making sure i had local time and utc time worked out at each point. The other was that Grafana doesn't like values like .25 without the leading zero and gives javascript errors  - “t.dataList.map is not a function”. which is why i have the line with  $FN(tValue,,4).

I have simplified my production code to make the principals clear. I could put it on github but it is so simple, it doesn't really warrant that.


 
Spoiler
Discussion (5)5
Log in or sign up to continue

And just to add some more details

I am using the SimpleJson plugin from Grafana Labs as my data source -   https://grafana.com/plugins/grafana-simple-json-datasource

The url http://localhost:52777/syshistory/ for that points to the REST application that is implemented by the page I included. When setting up the data source, I only checked ‘Basic Auth’ and added the username and password under ‘Basic Auth Details’.

dave

Hi @David Loveluck, and anybody who wanted it.

Have a look at one of my latest projects. I did Grafana plugin for IRIS, which can connect and gather any data directly. It's in active development and will be extended with much more possibilities very soon. And I'm going to publish it on Grafana Plugins list as well, for easier installation. Stay tuned, and do not hesitate to contact me directly or through issues in the repository, if you have some advice, what would you like to see there first.