We are trying kapacitor in kubernetes cluster to send the alert 
notifications .

As a example the "memory/usage" values send by heapster as stored as bytes 
in influxDB like this (3.60463797709804e+08). The equivalent readable value 
is  360MB.

My question is how to convert those values from mean('value') from bytes to 
Megabytes and compare.

Below is the tick file i used. 

// Parameters
var info = 10
var warn = 150
var crit = 170
var period = 2m
var every = 2m

stream
        |from() .database('k8s')
                .retentionPolicy('default')
                .measurement('memory/usage')
                .groupBy('hostname')

        |window()
             // keep the most recent 2m of data
            .period(period)
             // Every minute emit the last 2 minutes of data to check if 
the min is greater than 95
             // this could be any value, depending on how often you want to 
recheck the window.
            .every(every)
        |mean('value') 
            .as('used')

        |alert()
                .id('{{index .Tags "hostname" }} memory utilization in MB')
                .message('{{ .ID }} is {{ .Level }} value:{{ index .Fields 
"used" }}')
                .info(lambda: "used" > info)
                .warn(lambda: "used" > warn)
                .crit(lambda: "used" > crit)
                .stateChangesOnly()
                .log('/tmp/alerts.log')

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/0ea0f128-42d6-478a-9a01-e5e3f25cb4e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to