Cool Features in Grafana that You Might Missed

If you’re developing a chatbot, this might helps.

Fairuz A Hirzani
3 min readAug 26, 2018

We’ve been using Grafana as our monitoring dashboard for almost a year, and it has been beneficial for our daily operation monitoring. Our essential performance metrics is visualized in a beautiful form using this open source tools. It really helps us to have a clear understanding on how our services perform. You can read its cool features on their documentation here http://docs.grafana.org/.

we have about 60 or more dashboard like this, to monitor our services. beautiful, isn’t it?

Being able to always aware of our service performance metrics in realtime is our primary concern. There is one additional feature that I personally like from Grafana, and it helps us monitor even better. It’s a rendering API. A simple HTTP request to save the graph in image format. We’re combining this with Telegram Bot. So, everyone can monitor our data in a simple Telegram Bot command request, anywhere and anytime.

Rendering panel on grafana dashboard can be done by adding “render” on panel url. Example API Url Request to render panel on image format,
http://grafana_ip:port/render/d-solo/000000022/dashboardName?panelId=panelId&orgId=1&from=fromtimestamp&to=totimestamp&width=width&height=height&tz=UTC%2B07%3A00&var-customfilter=customrequest

The other way to generate api link is by navigate to share menu on certain panel, and click this,

send http get request to url generated by this menu

Here’s sample use case that utilizes this feature:

1. On-Demand Rendering

Create a command on a telegram to capture specific panel on the dashboard as requested. Let’s say, for example, it’s on the weekend, and you find out that your service quality is degraded by increasing of response time, followed by drop on success rate.

Your curiosity drives you to see what it may impact your server performance. Simply, it can be done by sending a telegram command message to capture panel on the dashboard you desire. Your data will be transmitted for you in a second. It will help you in many cases. When you feel you have to see your data immediately with ease, just send a message and let it captures for you.

2. Periodical Report.

Configure a scheduler to send HTTP request to Grafana API that captures specific panel on the dashboard, and submit to related Telegram Chat Room. There may be occurred important events which have a high impact on your service transaction. During that period of time, you want to be always informed about how your metrics behave. This scheduled task will help you monitor your most important metrics by capturing specific panel on the dashboard and send it to you, periodically.

3. Alerting

Set up an alarm when your metrics reach a certain threshold. There’s a feature in Grafana that will send alarm on given set of rules and send it using a telegram. In our case, we have our own alerting system. Hence, we’re not using this alerting feature that Grafana provide. We enhanced a little on our alerting system that basically adding several lines of codes to call Grafana rendering API, captures a related panel and send to related parties.

our alerting system using telegram bot and grafana render image api

chatbot dashboard data visualization grafana monitoring

Originally published at hirzani.com on August 26, 2018.

--

--

Fairuz A Hirzani

an Observer. Working on Maker’s Schedule. Love to capture colors and human emotions. Found an excitement on typing, code.. mostly.