Reputation: 3522
My area and line charts properly show the average of system.cpu.user.pct
and system.memory.used.pct
. 0.4 as 40%
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.
I want to multiply the value of system.cpu.user.pct
and system.memory.used.pct
by 100 to solve this problem
I have a feeling that maybe I could do something here. Value * 100 ? Can anyone give me tips?
Upvotes: 0
Views: 1229
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.
The gauge is working fine. (with Percentage Mode on or not)
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.
Upvotes: 2
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