From c0f79ba7d5a23577e44366be7bb28844f08e477c Mon Sep 17 00:00:00 2001
From: rpiotrowski <robert.piotrowski1@pg.edu.pl>
Date: Mon, 27 Jan 2025 14:58:19 +0100
Subject: [PATCH] Fix influxdb issue

---
 telegraf/etc/telegraf.conf | 54 ++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/telegraf/etc/telegraf.conf b/telegraf/etc/telegraf.conf
index fb9e693..02dca9a 100644
--- a/telegraf/etc/telegraf.conf
+++ b/telegraf/etc/telegraf.conf
@@ -43,7 +43,7 @@
   flush_jitter = "0s"
 
   ## Run telegraf in debug mode
-  debug = false
+  debug = true
   ## Run telegraf in quiet mode
   quiet = false
   ## Override default hostname, if empty use os.Hostname()
@@ -60,7 +60,8 @@
   # Multiple urls can be specified but it is assumed that they are part of the same
   # cluster, this means that only ONE of the urls will be written to each interval.
   # urls = ["udp://localhost:8089"] # UDP endpoint example
-  urls = ["http://influxdb:8086"] # required
+  urls = ["http://influxdb:8086"] 
+  # required
   # The target database for metrics (telegraf will create it if not exists)
   database = "influx" # required
   # Precision of writes, valid values are "ns", "us" (or "Âľs"), "ms", "s", "m", "h".
@@ -70,33 +71,34 @@
   ## Write timeout (for the InfluxDB client), formatted as a string.
   ## If not provided, will default to 5s. 0s means no timeout (not recommended).
   timeout = "5s"
-  #username = "admin"
-  #password = "admin"
+  username = "admin"
+  password = "admin"
   # Set the user agent for HTTP POSTs (can be useful for log differentiation)
   # user_agent = "telegraf"
   # Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
   # udp_payload = 512
+  skip_database_creation = false
 # Configuration for influxdb server to send metrics to                                                            
-[[outputs.influxdb]]                                                                                            
-   # The full HTTP or UDP endpoint URL for your InfluxDB instance.                                               
-   # Multiple urls can be specified but it is assumed that they are part of the same                             
-   # cluster, this means that only ONE of the urls will be written to each interval.                             
-   # urls = ["udp://localhost:8089"] # UDP endpoint example                                                      
-   urls = ["http://192.168.33.100:8087"] # required                                                              
-   # The target database for metrics (telegraf will create it if not exists)                                     
-   database = "sustronicsPilot3_3" # required                                                                    
-   # Precision of writes, valid values are "ns", "us" (or "Âľs"), "ms", "s", "m", "h".                            
-   # note: using second precision greatly helps InfluxDB compression                                             
-   precision = "s"                                                                                               
-   ## Write timeout (for the InfluxDB client), formatted as a string.                                            
-   ## If not provided, will default to 5s. 0s means no timeout (not recommended).                                
-   timeout = "5s"                                                                                                
-   username = "telegraf"                                                                                         
-   password = "telegraf"                                                                                         
-   # Set the user agent for HTTP POSTs (can be useful for log differentiation)                                   
-   # user_agent = "telegraf"                                                                                     
-   # Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)                                   
-   # udp_payload = 512                                                                                           
+# [[outputs.influxdb]]                                                                                            
+#    # The full HTTP or UDP endpoint URL for your InfluxDB instance.                                               
+#    # Multiple urls can be specified but it is assumed that they are part of the same                             
+#    # cluster, this means that only ONE of the urls will be written to each interval.                             
+#    # urls = ["udp://localhost:8089"] # UDP endpoint example                                                      
+#    urls = ["http://192.168.33.100:8087"] # required                                                              
+#    # The target database for metrics (telegraf will create it if not exists)                                     
+#    database = "sustronicsPilot3_3" # required                                                                    
+#    # Precision of writes, valid values are "ns", "us" (or "Âľs"), "ms", "s", "m", "h".                            
+#    # note: using second precision greatly helps InfluxDB compression                                             
+#    precision = "s"                                                                                               
+#    ## Write timeout (for the InfluxDB client), formatted as a string.                                            
+#    ## If not provided, will default to 5s. 0s means no timeout (not recommended).                                
+#    timeout = "5s"                                                                                                
+#    username = "telegraf"                                                                                         
+#    password = "telegraf"                                                                                         
+#    # Set the user agent for HTTP POSTs (can be useful for log differentiation)                                   
+#    # user_agent = "telegraf"                                                                                     
+#    # Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)                                   
+#    # udp_payload = 512                                                                                           
 
 
 
@@ -265,7 +267,7 @@
   #      key = type
 
 # Print all metrics that pass through this filter.
-#[[processors.printer]]
+[[processors.printer]]
   ## Maximum line length in bytes.  Useful only for debugging.
   # influx_max_line_bytes = 0
 
@@ -284,4 +286,4 @@
   ## to set the timestamp of the data during ingestion. This is generally NOT
   ## what you want as it can lead to data points captured at different times
   ## getting omitted due to similar data.
-  # influx_omit_timestamp = false
\ No newline at end of file
+  # influx_omit_timestamp = false
-- 
GitLab