一、准备工作
CentOS搭建最新版Prometheus将RabbitMQ集群指标exporter到Prometheus
二、获取InfluxDB
[root@node01 ~]# wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.3.x86_64.rpm
[root@node01 ~]# ll
total 97488
-rw-r--r--. 1 root root 64097226 Sep 30 2020 influxdb-1.8.3.x86_64.rpm
三、安装InfluxDB
[root@node01 ~]# yum localinstall -y influxdb-1.8.3.x86_64.rpm
四、启动InfluxDB
[root@node01 ~]# systemctl start influxdb
[root@node01 ~]# systemctl enable influxdb
五、配置InfluxDB
[root@node01 ~]# influx
Connected to http://localhost:8086 version 1.8.3
InfluxDB shell version: 1.8.3
> create database prometheus;
> create user prome with password '123321';
> grant all on prometheus to prome;
> show retention policies on prometheus;
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 8760h0m0s 168h0m0s 1 true
> alter retention policy "autogen" on "prometheus" duration 365d default;
> quit
[root@node01 ~]#
六、配置prometheus.yml
[root@node01 ~]# vi /opt/prometheus/prometheus.yml
#Remote write configuration (for Graphite, OpenTSDB, or InfluxDB).
remote_write:
- url: "http://node01:8086/api/v1/prom/write?db=prometheus"
# Remote read configuration (for InfluxDB only at the moment).
remote_read:
- url: "http://node01:8086/api/v1/prom/read?db=prometheus"
[root@node01 ~]# systemctl restart prometheus
七、测试结果
[root@node01 ~]# influx
Connected to http://localhost:8086 version 1.8.3
InfluxDB shell version: 1.8.3
> show databases;
name: databases
name
----
_internal
prometheus
test
> use prometheus;
Using database prometheus
> show measurements;
name: measurements
name
----
go_gc_duration_seconds
go_gc_duration_seconds_count
go_gc_duration_seconds_sum
go_goroutines
go_info
go_memstats_alloc_bytes
go_memstats_alloc_bytes_total
go_memstats_buck_hash_sys_bytes
...
prometheus_web_federation_warnings_total
promhttp_metric_handler_requests_in_flight
promhttp_metric_handler_requests_total
rabbitmq_channels
rabbitmq_connections
...
rabbitmq_uptime
rabbitmq_version_info
scrape_duration_seconds
scrape_samples_post_metric_relabeling
scrape_samples_scraped
scrape_series_added
up
>