equal
deleted
inserted
replaced
42 terminal, |
42 terminal, |
43 times |
43 times |
44 |
44 |
45 |
45 |
46 const |
46 const |
47 VERSION = "v0.1.0" |
47 VERSION = "v0.1.1" |
48 USAGE = """ |
48 USAGE = """ |
49 ./netdata_tsrelay [-q][-v][-h] --dbopts="[PostgreSQL connection string]" --listen-port=14866 --listen-addr=0.0.0.0 |
49 ./netdata_tsrelay [-q][-v][-h] --dbopts="[PostgreSQL connection string]" --listen-port=14866 --listen-addr=0.0.0.0 |
50 |
50 |
51 -q: Quiet mode. No output at all. Ignored if -d is supplied. |
51 -q: Quiet mode. No output at all. Ignored if -d is supplied. |
52 -d: Debug: Show incoming and parsed data. |
52 -d: Debug: Show incoming and parsed data. |
128 |
128 |
129 # Create or use existing Json object for modded data. |
129 # Create or use existing Json object for modded data. |
130 # |
130 # |
131 var pivot: JsonNode |
131 var pivot: JsonNode |
132 try: |
132 try: |
133 let key = parsed["timestamp"].get_num |
133 let key = parsed[ "timestamp" ].get_num |
134 |
134 |
135 if pivoted_data.has_key( key ): |
135 if pivoted_data.has_key( key ): |
136 pivot = pivoted_data[ key ] |
136 pivot = pivoted_data[ key ] |
137 else: |
137 else: |
138 pivot = newJObject() |
138 pivot = newJObject() |
158 try: |
158 try: |
159 db.exec sql( "BEGIN" ) |
159 db.exec sql( "BEGIN" ) |
160 for sample in samples: |
160 for sample in samples: |
161 var |
161 var |
162 timestamp = sample[ "timestamp" ].get_num |
162 timestamp = sample[ "timestamp" ].get_num |
163 host = sample[ "hostname" ].get_str |
163 host = sample[ "hostname" ].get_str.to_lowerascii |
164 sample.delete( "timestamp" ) |
164 sample.delete( "timestamp" ) |
165 sample.delete( "hostname" ) |
165 sample.delete( "hostname" ) |
166 db.exec sql( conf.insertsql ), timestamp, host, sample |
166 db.exec sql( conf.insertsql ), timestamp, host, sample |
167 db.exec sql( "COMMIT" ) |
167 db.exec sql( "COMMIT" ) |
168 except: |
168 except: |