Jin Lee
Jin Lee

Reputation: 3522

Metrics not showing properly with gauge type in Kibana

My area and line charts properly show the average of system.cpu.user.pct and system.memory.used.pct. 0.4 as 40%

enter image description here

However, when I use gauge type visualization, it doesn't show the data properly. Gauge expresses 0.4 not as 40% but seems to take it as 0.4 percent.

enter image description here

I want to multiply the value of system.cpu.user.pct and system.memory.used.pct by 100 to solve this problem

enter image description here

I have a feeling that maybe I could do something here. Value * 100 ? Can anyone give me tips?

Upvotes: 0

Views: 1229

Answers (2)

Jin Lee
Jin Lee

Reputation: 3522

This is how I solved it. In JSON Input,

{ 
       "script" : {       
             "inline" :  "doc['system.cpu.user.pct'].value * 100", 
             "lang" :  "painless" 
    }
}

If you are not sure of where, see below.

enter image description here

The gauge is working fine. (with Percentage Mode on or not)

enter image description here

You can do the same with system.memory.used.pct.


Also, keep in mind what apt-get_install_skill mentioned in his accepted answer. It is better to change the Ranges values for higher performance.

enter image description here

Upvotes: 2

apt-get_install_skill
apt-get_install_skill

Reputation: 2908

So as I mentioned in the comments section above, executions of scripts are always slowing down your queries since the output has to be calculated every time your dataset updates.

To avoid this, a simple solution would be to adapt the ranges of your gauge by dividing them by 100. Essentially this will lead to the same result as with the script by going the other way around (division by 100 instead of multiplication of 100).

Upvotes: 1

Related Questions