Trying to generate alert based on existing data count; alert a warning if 
threshold sum is 1 or else critical if threshold sum is equal to or greater 
than 2.

Tick script:

  var warn = 1
  var crit = 2

  var period = 10s
  var every = 10s

  // Dataframe
  var data = batch
      |query('''
                SELECT sum(column-name) AS stat
                FROM "database-name"."default"."measurement-name"
                WHERE "time" > now() - 60d
        ''')
          .period(period)
          .every(every)
          .groupBy(time(1m))

  // Thresholds
  var alert = data
      |alert()
          .id('{{ index .Tags "host"}}/disk_used')
          .message('{{ .ID }}:{{ index .Fields "stat" }}')
          .warn(lambda: "stat" == warn)
          .crit(lambda: "stat" >= crit)

  // Alert
  alert
          .log('/path/to/alerts/test-alerts.log')
DOT:
digraph incidentsdata_batch_test {
graph [throughput="0.00 batches/s"];

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

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

Manoj Gour
Team Anchors - eAPI Systems Team
804.912.0965

________________________________________________________

The information contained in this e-mail is confidential and/or proprietary to 
Capital One and/or its affiliates and may only be used solely in performance of 
work or services for Capital One. The information transmitted herewith is 
intended only for use by the individual or entity to which it is addressed. If 
the reader of this message is not the intended recipient, you are hereby 
notified that any review, retransmission, dissemination, distribution, copying 
or other use of, or taking of any action in reliance upon this information is 
strictly prohibited. If you have received this communication in error, please 
contact the sender and delete the material from your computer.

-- 
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/5C445BAE-36C6-4F83-A5FD-A0FFA93D43B0%40capitalone.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to