Skip to content

Commit 97d2d7c

Browse files
zipper-mengIcera Mag
authored and
Icera Mag
committed
feat(examples): modify some examples
1 parent 50b64e0 commit 97d2d7c

7 files changed

+8387
-88
lines changed

examples/cnosdb_in.toml examples/cnosdb_sub_influxdb.toml

+11-8
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,16 @@ omit_hostname = false
9797
## or "gosmi" which translates using the built-in gosmi library.
9898
# snmp_translator = "netsnmp"
9999

100-
# Generic socket listener capable of handling multiple socket types.
101100
[[inputs.cnosdb]]
102-
## URL to listen on
103-
service_address = ":8081"
104-
105-
[[outputs.file]]
106-
## Files to write to, "stdout" is a specially handled file.
107-
files = ["/tmp/test_telegraf.out"]
108-
101+
service_address = ":8803"
102+
103+
[[outputs.http]]
104+
url = "http://127.0.0.1:8086/write?db=telegraf"
105+
timeout = "5s"
106+
method = "POST"
107+
username = ""
108+
password = ""
109109
data_format = "influx"
110+
use_batch_format = true
111+
content_encoding = "identity"
112+
idle_conn_timeout = 10

examples/prometheus.toml examples/cnosdb_sub_tdengine.toml

+13-59
Original file line numberDiff line numberDiff line change
@@ -97,62 +97,16 @@ omit_hostname = false
9797
## or "gosmi" which translates using the built-in gosmi library.
9898
# snmp_translator = "netsnmp"
9999

100-
# Generic HTTP write listener
101-
[[inputs.http_listener_v2]]
102-
## Address and port to host HTTP listener on
103-
service_address = ":8080"
104-
105-
## Paths to listen to.
106-
paths = ["/remote_write"]
107-
108-
## Save path as http_listener_v2_path tag if set to true
109-
# path_tag = false
110-
111-
## HTTP methods to accept.
112-
# methods = ["POST", "PUT"]
113-
114-
## maximum duration before timing out read of the request
115-
# read_timeout = "10s"
116-
## maximum duration before timing out write of the response
117-
# write_timeout = "10s"
118-
119-
## Maximum allowed http request body size in bytes.
120-
## 0 means to use the default of 524,288,000 bytes (500 mebibytes)
121-
# max_body_size = "500MB"
122-
123-
## Part of the request to consume. Available options are "body" and
124-
## "query".
125-
# data_source = "body"
126-
127-
## Set one or more allowed client CA certificate file names to
128-
## enable mutually authenticated TLS connections
129-
# tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
130-
131-
## Add service certificate and key
132-
# tls_cert = "/etc/telegraf/cert.pem"
133-
# tls_key = "/etc/telegraf/key.pem"
134-
135-
## Minimal TLS version accepted by the server
136-
# tls_min_version = "TLS12"
137-
138-
## Optional username and password to accept for HTTP basic authentication.
139-
## You probably want to make sure you have TLS configured above for this.
140-
# basic_username = "foobar"
141-
# basic_password = "barfoo"
142-
143-
## Optional setting to map http headers into tags
144-
## If the http header is not present on the request, no corresponding tag will be added
145-
## If multiple instances of the http header are present, only the first value will be used
146-
# http_header_tags = {"HTTP_HEADER" = "TAG_NAME"}
147-
148-
## Data format to consume.
149-
## Each data format has its own unique set of configuration options, read
150-
## more about them here:
151-
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
152-
data_format = "prometheusremotewrite"
153-
154-
[[outputs.cnosdb]]
155-
url = "localhost:31006"
156-
user = "user"
157-
password = "pass"
158-
database = "telegraf"
100+
[[inputs.cnosdb]]
101+
service_address = ":8803"
102+
103+
[[outputs.http]]
104+
url = "http://127.0.0.1:6041/influxdb/v1/write?db=telegraf"
105+
timeout = "5s"
106+
method = "POST"
107+
username = "root"
108+
password = "taosdata"
109+
data_format = "influx"
110+
use_batch_format = true
111+
content_encoding = "identity"
112+
idle_conn_timeout = 10

examples/kafka.toml examples/kafka_to_cnosdb.toml

+10-6
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,13 @@ max_message_len = 1000000
230230
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
231231
data_format = "json"
232232

233-
[[outputs.cnosdb]]
234-
url = "localhost:31006"
235-
user = "user"
236-
password = "pass"
237-
database = "telegraf"
238-
233+
[[outputs.http]]
234+
url = "http://127.0.0.1:8902/api/v1/write?db=telegraf"
235+
timeout = "5s"
236+
method = "POST"
237+
username = "root"
238+
password = "root"
239+
data_format = "influx"
240+
use_batch_format = true
241+
content_encoding = "identity"
242+
idle_conn_timeout = 10

examples/mqtt.toml examples/mqtt_to_cnosdb.toml

+10-5
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ fields = ""
175175
# [[inputs.mqtt_consumer.topic.types]]
176176
# key = type
177177

178-
[[outputs.cnosdb]]
179-
url = "localhost:31006"
180-
user = "user"
181-
password = "pass"
182-
database = "telegraf"
178+
[[outputs.http]]
179+
url = "http://127.0.0.1:8902/api/v1/write?db=telegraf"
180+
timeout = "5s"
181+
method = "POST"
182+
username = "root"
183+
password = "root"
184+
data_format = "influx"
185+
use_batch_format = true
186+
content_encoding = "identity"
187+
idle_conn_timeout = 10

examples/opentsdb_telnet.toml examples/opentsdb_telnet_to_cnosdb.toml

+11-5
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,14 @@ data_format = "opentsdbtelnet"
196196
## Note: This setting is only used for splitting_strategy = "variable length".
197197
# splitting_length_field = {offset = 0, bytes = 0, endianness = "be", header_length = 0}
198198

199-
[[outputs.cnosdb]]
200-
url = "localhost:31006"
201-
user = "user"
202-
password = "pass"
203-
database = "telegraf"
199+
[[outputs.http]]
200+
url = "http://127.0.0.1:8902/api/v1/write?db=telegraf"
201+
timeout = "5s"
202+
method = "POST"
203+
username = "root"
204+
password = "root"
205+
data_format = "influx"
206+
use_batch_format = true
207+
content_encoding = "identity"
208+
idle_conn_timeout = 10
209+

examples/opentsdb.toml examples/opentsdb_to_cnosdb.toml

+11-5
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,14 @@ data_format = "opentsdb"
153153

154154
high_priority_io = true
155155

156-
[[outputs.cnosdb]]
157-
url = "localhost:31006"
158-
user = "user"
159-
password = "pass"
160-
database = "telegraf"
156+
[[outputs.http]]
157+
url = "http://127.0.0.1:8902/api/v1/write?db=telegraf"
158+
timeout = "5s"
159+
method = "POST"
160+
username = "root"
161+
password = "root"
162+
data_format = "influx"
163+
use_batch_format = true
164+
content_encoding = "identity"
165+
idle_conn_timeout = 10
166+

0 commit comments

Comments
 (0)