From f135f66e7e107ff8e2f986d63afefa936ba8ca8b Mon Sep 17 00:00:00 2001
From: Henryk Paluch <henryk.paluch@pickering.cz>
Date: Thu, 13 Aug 2020 12:14:47 +0000
Subject: [PATCH 1/2] Exclude aggregate interface 'all' thas has missing fields

---
 examples/telegraf/net/net_alert_batch.tick  | 5 +++--
 examples/telegraf/net/net_alert_stream.tick | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/examples/telegraf/net/net_alert_batch.tick b/examples/telegraf/net/net_alert_batch.tick
index f02031a20..0d76f759a 100644
--- a/examples/telegraf/net/net_alert_batch.tick
+++ b/examples/telegraf/net/net_alert_batch.tick
@@ -20,7 +20,8 @@ var unit = 1s
 
 // Dataframe
 var rawdata = batch
-  |query('''SELECT err_in, err_out, drop_in, drop_out FROM "telegraf"."autogen"."net" ''')
+  // "interface" 'all' has missing some fields - so it must be excluded from results
+  |query('''SELECT err_in, err_out, drop_in, drop_out FROM "telegraf"."autogen"."net" WHERE interface != 'all' ''')
     .period(period)
     .every(every)
     .groupBy('host', 'interface')
@@ -64,4 +65,4 @@ var alert = data
   
 // Alert  
 alert
-  .log('/tmp/net_alert_log.txt')
\ No newline at end of file
+  .log('/tmp/net_alert_log.txt')
diff --git a/examples/telegraf/net/net_alert_stream.tick b/examples/telegraf/net/net_alert_stream.tick
index 590ee81cd..385912023 100644
--- a/examples/telegraf/net/net_alert_stream.tick
+++ b/examples/telegraf/net/net_alert_stream.tick
@@ -22,6 +22,7 @@ var rawdata = stream
     .database('telegraf')
     .retentionPolicy('autogen')
     .measurement('net')
+    .where(lambda: "interface" != 'all' ) // "interface" 'all' has missing error fields so it must be excluded
     .groupBy('host', 'interface')
 
 var err_in = rawdata

From 5d305e20976e0ab404218ed544142a7545f6ebf8 Mon Sep 17 00:00:00 2001
From: Henryk Paluch <henryk.paluch@pickering.cz>
Date: Thu, 13 Aug 2020 12:19:09 +0000
Subject: [PATCH 2/2] Removed spurios EOL right before EOF

---
 examples/telegraf/net/net_alert_batch.tick | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/telegraf/net/net_alert_batch.tick b/examples/telegraf/net/net_alert_batch.tick
index 0d76f759a..6ad8012ef 100644
--- a/examples/telegraf/net/net_alert_batch.tick
+++ b/examples/telegraf/net/net_alert_batch.tick
@@ -65,4 +65,4 @@ var alert = data
   
 // Alert  
 alert
-  .log('/tmp/net_alert_log.txt')
+  .log('/tmp/net_alert_log.txt')
\ No newline at end of file