Divide CPU Load by CPU count in templated dashboard


#1

Hi, I banged my head on this for quite some time yesterday and so I thought this would make a good first post after googling around.

My templated dashboard has a servers array and as such I’d like to be able to dynamically divide the Load series by the CPU count of the selected server.

I thought that perhaps the divideSeries might be the answer with a nested count function but it didn’t give the expected output perhaps because it was a constant number. Now according to the divideSeries document I can use scale() instead and scale will accept a fraction.

Blockquote Takes a dividend metric and a divisor metric and draws the division result. A constant may not be passed. To divide by a constant, use the scale() function (which is essentially a multiplication operation) and use the inverse of the dividend. (Division by 8 = multiplication by 1/8 or 0.125)

I tried entering 1/8 or 0.125 in scale() and it complained. Is it possible and if so what is the formatting to get it to accept that? So far I made a hidden series that takes the CPU count and was hoping I could use it in the other Series to divide into scale.

Here’s the series that returns the CPU count and I was going to use scale(1/#F) or a nested count in scale if it doesn’t accept #F

image

And here’s one of 3 series that will track short, mid and longterm load:

image

So if I could use a fractional scale in functions that would be amazing.

If not I can live with just dividing in my head but I obsess about these little details :stuck_out_tongue:

If this has been addressed elsewhere, apologies, and I’ll be happy to follow a link.

Thanks!

Oh, and it’s a graphite backend and collectd is sending the data. I’d prefer not to have a collectd config solution as it would be easier just to change a panel than a bunch of linux servers.