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-job-name
33+ metrics_path: /metrics
34+ cvm_sd_configs:
35+ - region: ap-guangzhou
36+ ports:
37+ - 9100
38+ filters:
39+ - name: tag:示例标签键
40+ values:
41+ - 示例标签值
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+ },
72+ " exporterSpec" : {
73+ " mariadb" : false ,
74+ " redis" : false ,
75+ " vpngw" : false ,
76+ " lb" : false ,
77+ " nacos" : false ,
78+ " cos" : false ,
79+ " lb_public" : false ,
80+ " ces" : false ,
81+ " lighthouse" : false ,
82+ " cvm" : false ,
83+ " cynosdb_mysql" : false ,
84+ " vpnx" : false ,
85+ " dc" : false ,
86+ " dcg" : false ,
87+ " ckafka" : false ,
88+ " cmongo" : false ,
89+ " nat_gateway" : false ,
90+ " redis_mem" : false ,
91+ " zookeeper" : false ,
92+ " cdb" : false ,
93+ " self" : false ,
94+ " cdn" : false ,
95+ " tdmysql" : false ,
96+ " postgres" : false ,
97+ " dcx" : false ,
98+ " tdmq" : false
99+ }
100+ }
101+ })
102+ cluster_id = " "
103+ kube_type = 3
104+ }
105+
106+ # Integration Center: Health Check
107+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationBlackbox" {
108+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
109+ kind = " blackbox-exporter"
110+ content = jsonencode ({
111+ " name" : " blackbox-exporter-example" ,
112+ " kind" : " blackbox-exporter" ,
113+ " spec" : {
114+ " instanceSpec" : {
115+ " module" : " http_post" ,
116+ " urls" : [
117+ " http://127.0.0.1:9123"
118+ ],
119+ " labels" : {
120+ " instance" : " instance-abcd"
121+ }
122+ },
123+ " scrapeSpec" : {
124+ " interval" : " 15s"
125+ }
126+ }
127+ })
128+ cluster_id = " "
129+ kube_type = 3
130+ }
131+
132+ # Integration Center: Consul
133+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationConsul" {
134+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
135+ kind = " consul-exporter"
136+ content = jsonencode ({
137+ " name" : " consul-exporter-example" ,
138+ " kind" : " consul-exporter" ,
139+ " spec" : {
140+ " instanceSpec" : {
141+ " server" : " 127.0.0.1:9123" ,
142+ " labels" : {
143+ " instance" : " consul-abcd"
144+ }
145+ }
146+ }
147+ })
148+ cluster_id = " "
149+ kube_type = 3
150+ }
151+
152+ # Integration Center: ElasticSearch
153+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationEs" {
154+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
155+ kind = " es-exporter"
156+ content = jsonencode ({
157+ " name" : " ex-exporter-example" ,
158+ " kind" : " es-exporter" ,
159+ " spec" : {
160+ " instanceSpec" : {
161+ " url" : " http://127.0.0.1:9123" ,
162+ " labels" : {
163+ " instance" : " es-abcd"
164+ },
165+ " user" : " fugiat Duis minim" ,
166+ " password" : " exercitation cillum velit"
167+ },
168+ " exporterSpec" : {
169+ " all" : true ,
170+ " indicesSettings" : false ,
171+ " snapshots" : false ,
172+ " indices" : true ,
173+ " shards" : false
174+ }
175+ }
176+ })
177+ cluster_id = " "
178+ kube_type = 3
179+ }
180+
181+ # Integration Center: Kafka
182+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationKafka" {
183+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
184+ kind = " kafka-exporter"
185+ content = jsonencode ({
186+ " name" : " kafka-exporter-example" ,
187+ " kind" : " kafka-exporter" ,
188+ " spec" : {
189+ " instanceSpec" : {
190+ " servers" : [
191+ " 127.0.0.1:9123"
192+ ],
193+ " labels" : {
194+ " instance" : " ckafka-abcd"
195+ }
196+ },
197+ " exporterSpec" : {}
198+ }
199+ })
200+ cluster_id = " "
201+ kube_type = 3
202+ }
203+
204+ # Integration Center: Memcached
205+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationMemcached" {
206+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
207+ kind = " memcached-exporter"
208+ content = jsonencode ({
209+ " name" : " memcached-exporter-example" ,
210+ " kind" : " memcached-exporter" ,
211+ " spec" : {
212+ " instanceSpec" : {
213+ " address" : " 127.0.0.1:9123" ,
214+ " labels" : {
215+ " instance" : " crs-abcd"
216+ }
217+ }
218+ }
219+ })
220+ cluster_id = " "
221+ kube_type = 3
222+ }
223+
224+ # Integration Center: MongoDB
225+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationMongodb" {
226+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
227+ kind = " mongodb-exporter"
228+ content = jsonencode ({
229+ " name" : " mongodb-exporter-example" ,
230+ " kind" : " mongodb-exporter" ,
231+ " spec" : {
232+ " instanceSpec" : {
233+ " user" : " nisi ullamco eiusmod et ea" ,
234+ " password" : " Duis" ,
235+ " servers" : [
236+ " 127.0.0.1:9123" ,
237+ " 127.0.0.2:9123"
238+ ],
239+ " labels" : {
240+ " instance" : " cmgo-abcd"
241+ }
242+ },
243+ " exporterSpec" : {
244+ " collectors" : [
245+ " collection" ,
246+ " indexusage" ,
247+ " topmetrics"
248+ ]
249+ }
250+ }
251+ })
252+ cluster_id = " "
253+ kube_type = 3
254+ }
255+
256+ # Integration Center: Mysql
257+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationMysql" {
258+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
259+ kind = " mysql-exporter"
260+ content = jsonencode ({
261+ " name" : " mysql-exporter" ,
262+ " kind" : " mysql-exporter" ,
263+ " spec" : {
264+ " instanceSpec" : {
265+ " user" : " est" ,
266+ " password" : " id proident deserunt sint" ,
267+ " address" : " 127.0.0.1:9123" ,
268+ " labels" : {
269+ " instance" : " cdb-abcd"
270+ }
271+ }
272+ }
273+ })
274+ cluster_id = " "
275+ kube_type = 3
276+ }
277+
278+ # Integration Center: Postgres
279+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationPostgres" {
280+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
281+ kind = " postgres-exporter"
282+ content = jsonencode ({
283+ " name" : " postgres-exporter-example" ,
284+ " kind" : " postgres-exporter" ,
285+ " spec" : {
286+ " instanceSpec" : {
287+ " user" : " laborum reprehenderit" ,
288+ " password" : " pariatur" ,
289+ " address" : " 127.0.0.1:9123" ,
290+ " labels" : {
291+ " instance" : " postgres-abcd"
292+ }
293+ }
294+ }
295+ })
296+ cluster_id = " "
297+ kube_type = 3
298+ }
299+
300+ # Integration Center: Redis
301+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationRedis" {
302+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
303+ kind = " redis-exporter"
304+ content = jsonencode ({
305+ " name" : " redis-exporter-example" ,
306+ " kind" : " redis-exporter" ,
307+ " spec" : {
308+ " instanceSpec" : {
309+ " address" : " 127.0.0.1:9123" ,
310+ " password" : " ea sed quis id" ,
311+ " labels" : {
312+ " instance" : " crs-abcd"
313+ }
314+ }
315+ }
316+ })
317+ cluster_id = " "
318+ kube_type = 3
319+ }
320+
321+ # Integration Center: Scrape Job
322+ resource "tencentcloud_monitor_tmp_exporter_integration" "tmpExporterIntegrationRaw" {
323+ instance_id = tencentcloud_monitor_tmp_instance. tmpInstance . id
324+ kind = " raw-job"
325+ content = jsonencode ({
326+ " kind" : " raw-job" ,
327+ " spec" : {
328+ " job" : <<- EOT
329+ job_name: example-raw-job-name
330+ metrics_path: /metrics
331+ static_configs:
332+ - targets:
333+ - 127.0.0.1:9090
334+ EOT
335+ }
336+ })
337+ cluster_id = " "
338+ kube_type = 3
339+ }
0 commit comments