Prometheus采集主机监控参考部署下载,图形生成
系统exporter 安装参考Grafana downloadWindows参考图形生成参考win_exporterLinux参考node_exporterMysql参考Mysql_exporterSQL Server参考SQL exporterRedis 参考Redis_exportercadvisor参考cadvisorrabbitmq参考参考rabbitmq
snmp_exporter
参考图形展示在测试中
snmp_exporter
zabbix集成参考
download rabbitmq_exporter
- rabbitmq 数据采集器
rabbitmq_exporter 一键监控安装脚本
- 采集端口默认端口9419
16-41 行说明
Environmentvariabledefault descriptionRABBIT_URLhttp://127.0.0.1:15672url to rabbitMQ management plugin (must start with http(s)😕/)RABBIT_USERguestusername for rabbitMQ management plugin. User needs monitoring tag!RABBIT_PASSWORDguestpassword for rabbitMQ management pluginRABBIT_USER_FILElocation of file with username (useful for docker secrets)RABBIT_PASSWORD_FILElocation of file with password (useful for docker secrets)PUBLISH_PORT9419Listening port for the exporterPUBLISH_ADDR“”Listening host/IP for the exporterOUTPUT_FORMATTTYLog ouput format. TTY and JSON are suportedLOG_LEVELinfolog level. possible values: “debug”, “info”, “warning”, “error”, “fatal”, or “panic”CAFILEca.pempath to root certificate for access management plugin. Just needed if self signed certificate is used. Will be ignored if the file does not existCERTFILEclient-cert.pempath to client certificate used to verify the exporter’s authenticity. Will be ignored if the file does not existKEYFILEclient-key.pempath to private key used with certificate to verify the exporter’s authenticity. Will be ignored if the file does not existSKIPVERIFYfalsetrue/0 will ignore certificate errors of the management pluginSKIP_VHOST^$regex, matching vhost names are not exported. First performs INCLUDE_VHOST, then SKIP_VHOSTINCLUDE_VHOST.*regex vhost filter. Only queues in matching vhosts are exportedINCLUDE_QUEUES.*regex queue filter. Just matching names are exportedSKIP_QUEUES^$regex, matching queue names are not exported (useful for short-lived rpc queues). First performed INCLUDE, after SKIPRABBIT_CAPABILITIESbert,no_sortcomma-separated list of extended scraping capabilities supported by the target RabbitMQ serverRABBIT_EXPORTERSexchange,node,queueList of enabled modules. Possible modules: connections,shovel,federation,exchange,node,queue,memoryRABBIT_TIMEOUT30timeout in seconds for retrieving data from management plugin.MAX_QUEUES0max number of queues before we drop metrics (disabled if set to 0)EXCLUDE_METRICS
- Metric names to exclude from export. comma-seperated. e.g. “recv_oct, recv_cnt”. See exporter_*.go for names
vim /rabbitmq_exporter.sh
#!/bin/sh
# -*- coding: utf-8 -*-
# Date: 2022/11/29
echo "download rabbitmq_exporter"
sleep 2
wget -N -P /root/ https://github.com/kbudde/rabbitmq_exporter/releases/download/v1.0.0-RC19/rabbitmq_exporter_1.0.0-RC19_linux_amd64.tar.gz
echo "Unzip rabbitmq_exporter"
sleep 2
mkdir -p /usr/local/rabbitmq_exporter
tar -zxf /root/rabbitmq_exporter_1.0.0-RC19_linux_amd64.tar.gz -C /usr/local/rabbitmq_exporter
echo "add config.json"
sleep 2
cat >>/usr/local/rabbitmq_exporter/config.json << EOF
{
"rabbit_url": "http://127.0.0.1:15672",
"rabbit_user": "admin",
"rabbit_pass": "admin@123",
"publish_port": "9419",
"publish_addr": "",
"output_format": "TTY",
"ca_file": "ca.pem",
"cert_file": "client-cert.pem",
"key_file": "client-key.pem",
"insecure_skip_verify": false,
"exlude_metrics": [],
"include_queues": ".*",
"skip_queues": "^$",
"skip_vhost": "^$",
"include_vhost": ".*",
"rabbit_capabilities": "no_sort,bert",
"enabled_exporters": [
"exchange",
"node",
"overview",
"queue"
],
"timeout": 30,
"max_queues": 0
}
EOF
echo "rabbitmq_exporter Creating a Service Script"
sleep 2
cat >>/usr/lib/systemd/system/rabbitmq_exporter.service<< EOF
[Unit]
Description=rabbitmq_exporter
Documentation=https://github.com/kbudde/rabbitmq_exporter/releases
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/rabbitmq_exporter/rabbitmq_exporter \
-config-file=/usr/local/rabbitmq_exporter/config.json
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
echo "rabbitmq_exporter Example Set the automatic startup service"
sleep 2
systemctl daemon-reload && systemctl enable --now rabbitmq_exporter
rm -rf /root/rabbitmq_exporter_1.0.0-RC19_linux_amd64.tar.gz
执行安装
sh /rabbitmq_exporter.sh
数据采集结果
Prometheus代码设置
- job_name: 'Rabbitmq'
scrape_interval: 5s
static_configs:
- targets:
- 192.168.11.230:9419
labels:
instance: RabbitMQ-192.168.11.230
Grafana 图形展示
- 模板号集群10991,14798,11340(以下三项都是用于集群)
- RabbitMQ-Overview
- RabbitMQ-Quorum-Queues-Raft
- RabbitMQ-Stream
单机图形展示
- 4279 模板号单机 RabbitMQ Monitoring
版权归原作者 CIAS 所有, 如有侵权,请联系我们删除。