Lowercase all hostnames before sending to the database.
authorMahlon E. Smith <mahlon@martini.nu>
Tue, 26 Jun 2018 09:47:23 -0700
changeset 15 ed87882bb7f0
parent 14 717e89280a20
child 16 fce5b4150c09
Lowercase all hostnames before sending to the database.
netdata_tsrelay.nim
--- a/netdata_tsrelay.nim	Mon Mar 05 15:34:12 2018 -0800
+++ b/netdata_tsrelay.nim	Tue Jun 26 09:47:23 2018 -0700
@@ -44,7 +44,7 @@
 
 
 const
-    VERSION = "v0.1.0"
+    VERSION = "v0.1.1"
     USAGE = """
 ./netdata_tsrelay [-q][-v][-h] --dbopts="[PostgreSQL connection string]" --listen-port=14866 --listen-addr=0.0.0.0
 
@@ -130,7 +130,7 @@
         #
         var pivot: JsonNode
         try:
-            let key = parsed["timestamp"].get_num
+            let key = parsed[ "timestamp" ].get_num
 
             if pivoted_data.has_key( key ):
                 pivot = pivoted_data[ key ]
@@ -160,7 +160,7 @@
         for sample in samples:
             var
                 timestamp = sample[ "timestamp" ].get_num
-                host = sample[ "hostname" ].get_str
+                host = sample[ "hostname" ].get_str.to_lowerascii
             sample.delete( "timestamp" )
             sample.delete( "hostname" )
             db.exec sql( conf.insertsql ), timestamp, host, sample