On Monday, November 14, 2016 at 7:32:20 AM UTC-6, [email protected] wrote:
> Hi,
>
> I have couple of doubts in tickscripts, looking for some help with them.
>
> Below is the script where I want to find the stddev of a field and want to
> compare it to trigger alerts. But no alerts are getting triggered though
> there are no errors.
>
> Want to understand if the conditional statement I have given has to do
> something with it. Please correct me if I am wrong, also let me know what is
> the best possible way to achieve this.
> batch
> |query('''
> SELECT Airtemp
> FROM "Station"."autogen"."Temprature"
> ''')
> .period(30m)
> .every(15m)
> .groupBy('Airtemp','Station')
> |stddev('Airtemp')
> .as('stat')
> |alert()
> .id('Standard Deviation of Air Temperature : {{ .TaskName }} Alert
> Time : {{ .Time }}')
> .crit(lambda: "stat" >= 5 AND "stat" <= 4)
> .message('{{ .ID }}')
> .log('/tmp/station_sd.log')
> |influxDBOut()
> .database('Station')
> .retentionPolicy('autogen')
> .flushInterval(1s)
> .measurement('stationsd')
> ========================================================================
>
> This is one another tickscript where .crit(lambda: 'scoreField' >= 'x')
> conditions throws error saying invalid comparison, I want to know if it is
> valid in first place to put in a conditional statement within @Morgoth, if
> this is good then kindly advice me how to correct this particular script to
> produce results.
>
>
> // The measurement to analyze
> var measurement = 'eventflow_IIS'
>
> // The amount of data to window at once
> var window = 5m
>
> //Define variable
> var x = 0.9
>
> // The field to process
> var field = 'eventcount'
>
> // The field to group by
> var field1 = 'status'
>
> // The name for the anomaly score field
> var scoreField = 'anomalyScore'
>
> // The minimum support
> var minSupport = 0.8
>
> // The error tolerance
> var errorTolerance = 0.15
>
> // The consensus
> var consensus = -1.0
>
> // Number of sigmas allowed for normal window deviation
> var sigmas = 5.0
>
> batch
> |query('''
> SELECT *
> FROM "statistics"."autogen"."eventflow_IIS"
> ''')
> .period(5m)
> .every(5m)
> .groupBy(field,field1)
> // |.where(lambda: TRUE)
>
> @morgoth()
> .field(field)
> .scoreField(scoreField)
> .minSupport(minSupport)
> .errorTolerance(errorTolerance)
> .consensus(consensus)
> // Configure a single Sigma fingerprinter
> .sigma(sigmas)
> // Morgoth returns any anomalous windows
> |alert()
> .details('Count is anomalous')
> .id('kapacitor/{{ .TaskName }}/{{ .Name }}/{{ .Group }}')
> .message('{{ .ID }} is at level {{ .Level }} Errorcount is:{{ index
> .Fields "eventcount" }}')
> .crit(lambda: 'scoreField' >= 'x')
> .log('/tmp/anomaly_e.log')
> |influxDBOut()
> .database('anomaly')
> .retentionPolicy('autogen')
> .flushInterval(1s)
> .measurement('Anomaly_e')
Could it be that in your select query you have this
SELECT Airtemp
FROM "Station"."autogen"."Temprature"
But meant this
SELECT Airtemp
FROM "Station"."autogen"."Temperature"
I found it helpful to run the queries on the command line or InfluxDB Admin
Tool to make sure that they run correctly.
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" 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/4917acca-5746-4b6a-a939-74e439bb6751%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.