Skip to content

Commit 656511a

Browse files
authored
Merge pull request #1397 from smallpath/master
Add TMP Integration Center Example
2 parents 33df96f + a537c11 commit 656511a

File tree

2 files changed

+346
-0
lines changed

2 files changed

+346
-0
lines changed

examples/tencentcloud-tmp/main.tf

Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
resource "tencentcloud_vpc" "vpc" {
2+
name = "tf-eks-vpc"
3+
cidr_block = "10.2.0.0/16"
4+
}
5+
6+
resource "tencentcloud_subnet" "sub" {
7+
vpc_id = tencentcloud_vpc.vpc.id
8+
name = "tf-as-subnet"
9+
cidr_block = "10.2.11.0/24"
10+
availability_zone = "ap-guangzhou-3"
11+
}
12+
13+
resource "tencentcloud_monitor_tmp_instance" "tmpInstance" {
14+
instance_name = "tf-test-tmp"
15+
vpc_id = tencentcloud_vpc.vpc.id
16+
subnet_id = tencentcloud_subnet.sub.id
17+
data_retention_time = 15
18+
zone = "ap-guangzhou-3"
19+
tags = {
20+
"createdBy" = "terraform"
21+
}
22+
}
23+
24+
# Integration Center: CVM Scrape Job
25+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegration" {
26+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
27+
kind = "cvm-http-sd-exporter"
28+
content = jsonencode({
29+
"kind": "cvm-http-sd-exporter",
30+
"spec": {
31+
"job": <<-EOT
32+
job_name: example-cvm-job-name
33+
metrics_path: /metrics
34+
cvm_sd_configs:
35+
- region: ap-guangzhou
36+
ports:
37+
- 9100
38+
filters:
39+
- name: tag:YOUR_TAG_KEY
40+
values:
41+
- YOUR_TAG_VALUE
42+
relabel_configs:
43+
- source_labels: [__meta_cvm_instance_state]
44+
regex: RUNNING
45+
action: keep
46+
- regex: __meta_cvm_tag_(.*)
47+
replacement: $1
48+
action: labelmap
49+
- source_labels: [__meta_cvm_region]
50+
target_label: region
51+
action: replace
52+
EOT
53+
}
54+
})
55+
kube_type = 3
56+
cluster_id = ""
57+
}
58+
59+
# Integration Center: Cloud Monitor
60+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationCloudMonitor" {
61+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
62+
kind = "qcloud-exporter"
63+
content = jsonencode({
64+
"name": "qcloud-exporter-example",
65+
"kind": "qcloud-exporter",
66+
"spec": {
67+
"instanceSpec": {
68+
"region": "ap-singapore",
69+
"delaySeconds": 0,
70+
"useRole": true,
71+
"reload_interval_minutes": 10
72+
},
73+
"exporterSpec": {
74+
"mariadb": false,
75+
"redis": false,
76+
"vpngw": false,
77+
"lb": false,
78+
"nacos": false,
79+
"cos": false,
80+
"lb_public": false,
81+
"ces": false,
82+
"lighthouse": false,
83+
"cvm": false,
84+
"cynosdb_mysql": false,
85+
"vpnx": false,
86+
"dc": false,
87+
"dcg": false,
88+
"ckafka": false,
89+
"cmongo": false,
90+
"nat_gateway": false,
91+
"redis_mem": false,
92+
"zookeeper": false,
93+
"cdb": false,
94+
"self": false,
95+
"cdn": false,
96+
"tdmysql": false,
97+
"postgres": false,
98+
"dcx": false,
99+
"tdmq": false,
100+
"dts": false,
101+
"vbc": false,
102+
"gaap": false
103+
}
104+
}
105+
})
106+
cluster_id = ""
107+
kube_type = 3
108+
}
109+
110+
# Integration Center: Health Check
111+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationBlackbox" {
112+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
113+
kind = "blackbox-exporter"
114+
content = jsonencode({
115+
"name": "blackbox-exporter-example",
116+
"kind": "blackbox-exporter",
117+
"spec": {
118+
"instanceSpec": {
119+
"module": "http_post",
120+
"urls": [
121+
"http://127.0.0.1:9123"
122+
],
123+
"labels": {
124+
"instance": "instance-abcd"
125+
}
126+
},
127+
"scrapeSpec": {
128+
"interval": "15s"
129+
}
130+
}
131+
})
132+
cluster_id = ""
133+
kube_type = 3
134+
}
135+
136+
# Integration Center: Consul
137+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationConsul" {
138+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
139+
kind = "consul-exporter"
140+
content = jsonencode({
141+
"name": "consul-exporter-example",
142+
"kind": "consul-exporter",
143+
"spec": {
144+
"instanceSpec": {
145+
"server": "127.0.0.1:9123",
146+
"labels": {
147+
"instance": "consul-abcd"
148+
}
149+
}
150+
}
151+
})
152+
cluster_id = ""
153+
kube_type = 3
154+
}
155+
156+
# Integration Center: ElasticSearch
157+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationEs" {
158+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
159+
kind = "es-exporter"
160+
content = jsonencode({
161+
"name": "ex-exporter-example",
162+
"kind": "es-exporter",
163+
"spec": {
164+
"instanceSpec": {
165+
"url": "http://127.0.0.1:9123",
166+
"labels": {
167+
"instance": "es-abcd"
168+
},
169+
"user": "fugiat Duis minim",
170+
"password": "exercitation cillum velit"
171+
},
172+
"exporterSpec": {
173+
"all": true,
174+
"indicesSettings": false,
175+
"snapshots": false,
176+
"indices": true,
177+
"shards": false
178+
}
179+
}
180+
})
181+
cluster_id = ""
182+
kube_type = 3
183+
}
184+
185+
# Integration Center: Kafka
186+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationKafka" {
187+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
188+
kind = "kafka-exporter"
189+
content = jsonencode({
190+
"name": "kafka-exporter-example",
191+
"kind": "kafka-exporter",
192+
"spec": {
193+
"instanceSpec": {
194+
"servers": [
195+
"127.0.0.1:9123"
196+
],
197+
"labels": {
198+
"instance": "ckafka-abcd"
199+
}
200+
},
201+
"exporterSpec": {}
202+
}
203+
})
204+
cluster_id = ""
205+
kube_type = 3
206+
}
207+
208+
# Integration Center: Memcached
209+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationMemcached" {
210+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
211+
kind = "memcached-exporter"
212+
content = jsonencode({
213+
"name": "memcached-exporter-example",
214+
"kind": "memcached-exporter",
215+
"spec": {
216+
"instanceSpec": {
217+
"address": "127.0.0.1:9123",
218+
"labels": {
219+
"instance": "crs-abcd"
220+
}
221+
}
222+
}
223+
})
224+
cluster_id = ""
225+
kube_type = 3
226+
}
227+
228+
# Integration Center: MongoDB
229+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationMongodb" {
230+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
231+
kind = "mongodb-exporter"
232+
content = jsonencode({
233+
"name": "mongodb-exporter-example",
234+
"kind": "mongodb-exporter",
235+
"spec": {
236+
"instanceSpec": {
237+
"user": "nisi ullamco eiusmod et ea",
238+
"password": "Duis",
239+
"servers": [
240+
"127.0.0.1:9123",
241+
"127.0.0.2:9123"
242+
],
243+
"labels": {
244+
"instance": "cmgo-abcd"
245+
}
246+
},
247+
"exporterSpec": {
248+
"collectors": [
249+
"collection",
250+
"indexusage",
251+
"topmetrics"
252+
]
253+
}
254+
}
255+
})
256+
cluster_id = ""
257+
kube_type = 3
258+
}
259+
260+
# Integration Center: Mysql
261+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationMysql" {
262+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
263+
kind = "mysql-exporter"
264+
content = jsonencode({
265+
"name": "mysql-exporter",
266+
"kind": "mysql-exporter",
267+
"spec": {
268+
"instanceSpec": {
269+
"user": "est",
270+
"password": "id proident deserunt sint",
271+
"address": "127.0.0.1:9123",
272+
"labels": {
273+
"instance": "cdb-abcd"
274+
}
275+
}
276+
}
277+
})
278+
cluster_id = ""
279+
kube_type = 3
280+
}
281+
282+
# Integration Center: Postgres
283+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationPostgres" {
284+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
285+
kind = "postgres-exporter"
286+
content = jsonencode({
287+
"name": "postgres-exporter-example",
288+
"kind": "postgres-exporter",
289+
"spec": {
290+
"instanceSpec": {
291+
"user": "laborum reprehenderit",
292+
"password": "pariatur",
293+
"address": "127.0.0.1:9123",
294+
"labels": {
295+
"instance": "postgres-abcd"
296+
}
297+
}
298+
}
299+
})
300+
cluster_id = ""
301+
kube_type = 3
302+
}
303+
304+
# Integration Center: Redis
305+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationRedis" {
306+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
307+
kind = "redis-exporter"
308+
content = jsonencode({
309+
"name": "redis-exporter-example",
310+
"kind": "redis-exporter",
311+
"spec": {
312+
"instanceSpec": {
313+
"address": "127.0.0.1:9123",
314+
"password": "ea sed quis id",
315+
"labels": {
316+
"instance": "crs-abcd"
317+
}
318+
}
319+
}
320+
})
321+
cluster_id = ""
322+
kube_type = 3
323+
}
324+
325+
# Integration Center: Scrape Job
326+
resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationRaw" {
327+
instance_id = tencentcloud_monitor_tmp_instance.tmpInstance.id
328+
kind = "raw-job"
329+
content = jsonencode({
330+
"kind": "raw-job",
331+
"spec": {
332+
"job": <<-EOT
333+
job_name: example-raw-job-name
334+
metrics_path: /metrics
335+
static_configs:
336+
- targets:
337+
- 127.0.0.1:9090
338+
EOT
339+
}
340+
})
341+
cluster_id = ""
342+
kube_type = 3
343+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
terraform {
2+
required_version = ">= 0.12"
3+
}

0 commit comments

Comments
 (0)