Mathematic function in query

Hello!

I am a new user of influxdb. We are using influx for storing our nagios performance-values.
now I want to create a select-statement with mathematic function.
we are using version 1.2.2.

my counter stores the full-state in percent of my harddiscs.

time                crit host    performanceLabel service                unit value warn
----                ---- ----    ---------------- -------                ---- ----- ----
1510812121000000000 96   <host>  D:\ used %       NRPE_Windows_Diskspace %    17     92 

I want to create a select where I add a new row with a modolo-operation. I know this is possible in verstion 1.3. But I don’t have it.
So I have to create my own function :slight_smile: I want to have the number “1” in that row if value >= warn!
This is possible with: (warn-(integer(warn/value)*value))/warn
But when I try this I have a problem with (warn/value)*value. I only will get wrong data:

time                value warn crit modwarn
----                ----- ---- ---- -------
1510813021000000000 1     92   96   40

wan/value is ok:

    time                value warn crit modwarn
    ----                ----- ---- ---- -------
    1510813021000000000 1     92   96   92
    1510813021000000000 51    92   96   1.803921568627451
    1510813021000000000 4     93   97   23.25
    1510813021000000000 45    92   96   2.0444444444444443
    1510813021000000000 61    92   96   1.5081967213114753

here my statement:
SELECT value,warn,crit, (40-(value*(40/value)))/40 as modwarn FROM "metrics" WHERE "host" =~ /^<host>$/ AND "service" =~ /NRPE_Windows_Diskspace/ AND "performanceLabel" =~ /used %/ AND time > now() - 15m

what is wrong in my statement?

rg
hansi