ID: lead_alert
Error: 
Type: batch
Status: enabled
Executing: true
Created: 06 Aug 16 05:08 UTC
Modified: 25 Aug 16 08:59 UTC
LastEnabled: 25 Aug 16 08:59 UTC
Databases Retention Policies: ["product"."default"]
TICKscript:

var last_1_day_trips = batch
    |query(''' 
              SELECT sum(count) as count 
              FROM "product"."default".leads
            ''')
        .period(1d)
        .every(12h)

var last_2_day_trips = batch
    |query(''' 
              SELECT sum(count) as count
              FROM "product"."default".leads
           ''')
        .period(2d)
        .every(12h)

last_1_day_trips
    |join(last_2_day_trips)
        .as('last_1_day_trips', 'last_2_day_trips')
        .tolerance(2d)
        .fill(0.0)
    |eval(lambda: int("last_1_day_trips.count"), lambda: 
int("last_2_day_trips.count" - "last_1_day_trips.count"), lambda: float(100 
* float(float("last_2_day_trips.count" - "last_1_day_trips.count" - 
"last_1_day_trips.count") / float("last_2_day_trips.count" - 
"last_1_day_trips.count"))))
        .as('today_trip', 'yester_trip', 'perc')
    |alert()
        .id('Lead creation Deep/Increase alert Task Name : {{ .TaskName }} 
Alert Time : {{ .Time }}')
        .message('{{ .ID }}')
        .details('''
          <h2>{{ .ID }}</h2>
          <p>Total Trip Created today: {{ index .Fields "today_trip"  }}</p>
          <p>Total Trip Created yesterday: {{ index .Fields "yester_trip"  
}}</p>
          <p>Trip Deep/Increase: {{ index .Fields "perc" }} </p>
      ''')
        .info(lambda: TRUE)
        .email('[email protected]')


DOT:
digraph lead_alert {
graph [throughput="0.00 batches/s"];

query2 [avg_exec_time_ns="0" batches_queried="2" connect_errors="0" 
points_queried="2" query_errors="0" ];
query2 -> join4 [processed="2"];

query1 [avg_exec_time_ns="0" batches_queried="2" connect_errors="0" 
points_queried="2" query_errors="0" ];
query1 -> join4 [processed="2"];

join4 [avg_exec_time_ns="0" ];
join4 -> eval5 [processed="0"];

eval5 [avg_exec_time_ns="0" eval_errors="0" ];
eval5 -> alert6 [processed="0"];

alert6 [alerts_triggered="0" avg_exec_time_ns="0" crits_triggered="0" 
infos_triggered="0" oks_triggered="0" warns_triggered="0" ];
}



why join trigger alert 

-- 

-- 
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/4cee6d29-2eb0-4c25-97ab-cb13cce8fc2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to