# Calculate Cost

(Luis N) #1

So i am getting 2 different metrics by doing filters , then displaying the value.
How can i calculate using those 2 values? I want to multiply those 2 values and then again with a static value ill input

So i have SOMETHING going with this using search and google

.es(timefield=@timestamp, q='name:"Service: UPS Battery Output Voltage"', index=nagios*, metric=avg:value).multiply(.es(timefield=@timestamp, q='name:"Service: UPS Battery Output Amperage"', index=nagios*, metric=avg:value)).divide(1000)

but now have to multiply this with the timefield of whatever is selected ex: last 15 mins, day etc against the above query
so query_number*(last 15 mins or time selected) = then multiply this by .08\$ and display the metric which = ex: 4.50\$ etc etc etc

trying this, can someone confirm at least this works? .es(timefield=@timestamp, q='name:"Service: UPS Battery Output Voltage"', index=nagios*, metric=avg:value).multiply(.es(timefield=@timestamp, q='name:"Service: UPS Battery Output Amperage"', index=nagios*, metric=avg:value)).divide(1000).multiply(.es(nagioscheck*,timefield=1h))
would like it if it was selecible though

(Peter Pisljar) #2

timelion is used for displaying time series, it seems you want to display a single metric ? that's unfortunately not possible.

You could try Visual Builder (go to visualize and select visual builder, just next to timelion) however, it has a metric option.

also you might want to check out kibana canvas, its not released yet but some previews are available https://canvas.elastic.co/

(Luis N) #3

Is there a way to display a metric but call a different value from a filter?

(Luis N) #4

So i went a bit further and just did the math within my script and then sent the info to ELK. So now my question is, how do i choose the timeframe picked by the user as path of the equation?

forgot to mention i need to use the time as a number in hours, if a time like 15mins is selected then has to be .25 and so on.

I am trying to see the cost per selected time of kwh

(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.