Grafana binary or percent values

grafana

(Arethusa) #1

Hello everyone,

I used: Icinga2, Grafana, influxDB and snmpV3.

All work good ^^ (thanks to you).

For example, I want to have the SLA on the port 9200 (elasticsearch).

So i already can graph it, but my graph if from 9200 to 0 (it’s logical).

If I stop the service elasticsearch, the port goes to 0 (it’s normal too).

And on grafana, if i control the “average” i can will have a value between 9200 and 0 (4600 if i stop the service half time).

So now, the question: is it possible on Grafana to convert 9200 (the max value on the scale) to binaries value (0 to 1) or percent value (0 to 100).

If it’s not possible, i will do a script like:
If port = 9200, then echo 100, else echo 0, fi

And of course, I will have 100 or 0… But if you do that on Grafana that can be useful.

Thank you.


(Carsten Köbke) #2

Hi,
You can do such things with the math() function inside a panel. see the Grafana Docs for more informations.

Regards,
Carsten


(Arethusa) #3

Hello Carsten, thank you for you time.

I will try to do this, i have found "math(/100) on panel, but that look like hard to used.

If any one have an example, for yet, i go to try again.

Thank you.


(Carsten Köbke) #4

Try it with math(/9200*100)


(Arethusa) #5

Carsten,

One word “gg” ^^ That works very good.

We need 3 points :

  • match (/9200*100) (or other port)
  • fill (0) to see the null state
  • choice “Avg” on Legend

And you have a SLA from port.

Thank you very much, you were very helpful !