赞
踩
服务安装后都在在prometheus的配置文件中配置路径,本文主要是描写监控的服务下载及启动,对配置不作详细介绍
每添加一个服务,在prometheus的配置文件中添加(此方法为静态添加):
- job_name: 'node'
static_configs:
- targets: ['监控ip']
instance: lab1
目前监控的服务有如下,将采用不同方式去安装:
rabbitMq(监控端口9099):
下载地址:https://github.com/kbudde/rabbitmq_exporter/releases
启动命令:RABBIT_USER=admin RABBIT_PASSWORD=admin OUTPUT_FORMAT=JSON PUBLISH_PORT=9099 RABBIT_URL=http://localhost:15672 nohup ./rabbitmq_exporter &
grafana模板:https://grafana.com/dashboards/2121
监控访问地址:http://ip:9099/metrics
Cadvisor:docker(端口8080可修改):
启动命令:
docker run \
--volume=/home/prometheus/cadvisor:/rootfs:ro \
--volume=/var/run:/var/run:ro \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor
grafana模板:https://grafana.com/grafana/dashboards/10566
监控访问地址:http://ip:8080/metrics
mysql:
下载地址:https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz
配置文件:
[client]
host=ip//远程mysql地址,本地的话就不需要这一项
user=exporter //mysql用户名
password=xiangsikai //密码
启动命令:nohup ./mysqld_exporter --config.my-cnf=.my.cnf &
grafana模板:https://grafana.com/dashboards/7362
监控访问地址:http://ip:9104/metrics
linux:
下载地址:https://prometheus.io/docs/guides/node-exporter/
启动命令:nohup ./node_exporter &
grafana模板:https://grafana.com/dashboards/8919
监控访问地址:http://ip:9100/metrics
oracle:
下载地址:https://github.com/iamseth/oracledb_exporter/releases
启动命令:
export DATA_SOURCE_NAME=用户名/密码@//ip:1521/数据库服务名称
nohup ./oracledb_exporter &
grafana模板:https://grafana.com/grafana/dashboards/3333
监控访问地址:http://ip:9161/metrics
redis:
下载地址:wget https://github.com/oliver006/redis_exporter/releases/download/v0.30.0/redis_exporter-v0.30.0.linux-amd64.tar.gz
启动命令:nohup ./redis_exporter -redis.addr ip:6379 (有密码就接上-redis.password 密码) &
监控访问地址:http://ip:9121/metrics
windows
下载地址:https://github.com/martinlindhe/wmi_exporter/releases
启动:安装后点击即启动,无需命令
grafana模板:https://grafana.com/grafana/dashboards/10467
监控访问地址:http://ip:9182/metrics
snmp交换机:
前提交换机上要装snmp,并且能够正常连接
下载地址:wget https://github.com/prometheus/snmp_exporter/releases/download/v0.13.0/snmp_exporter-0.13.0.linux-amd64.tar.gz
启动命令:nohup ./snmp_exporter --config.file=snmp.yml &
grafana模板:https://download.csdn.net/download/YI_XNH/13704860(官方模板很多数据出不来,需要下载,但是这个模板也不算很精确,目前还没找到合适的模板)
监控访问地址:http://ip:9116/metrics
snmp配置较为麻烦,参考:https://blog.csdn.net/yi_xnh/article/details/111267502
sqlserver:
下载:wget https://github.com/free/sql_exporter/releases/download/0.5/sql_exporter-0.5.linux-amd64.tar.gz
配置:修改sql_exporter.yml中的连接信息
data_source_name: 'sqlserver://用户名:密码@ip:1433'
启动命令:nohup ./sql_exporter --config.file=sql_exporter.yml &
监控访问地址:http://ip:9399/metrics
jmx(java应用程序,此处针对springboot的jar包启动方式程序监控):
下载:https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.3.1/jmx_prometheus_javaagent-0.3.1.jar
配置文件:参考https://blog.csdn.net/qq_25934401/article/details/82185236(主要配置指标)
启动命令:java -javaagent:./jmx_prometheus_javaagent-0.3.0.jar=9151:config.yaml -jar yourJar.jar
监控访问地址:http://ip:9151/metrics
process:
下载:https://github.com/ncabatoff/process-exporter/releases/download/v0.4.0/process-exporter-0.4.0.linux-amd64.tar.gz
配置文件:参考https://www.cnblogs.com/huandada/p/10431667.html
启动命令:nohup ./process-exporter -config.path process-name.yaml &
监控访问地址:http://ip:9256/metrics
grafana监控地址:https://grafana.com/grafana/dashboards/246
prometheus:
docker run -d -p 9090:9090 -v /root/prometheus.yml(实际prometheus.yml的路径):/etc/prometheus/prometheus.yml --name prometheus --net=host prom/prometheus
consul:
docker run --name consul --privileged=true -p 8500:8500 -v /data/consul/conf/:/consul/conf/ -v /data/consul/data/:/consul/data/ -d consu
grafana:
docker run -d -p 3000:3000 -v /home/prom/grafana:/var/lib/grafana --name=grafana grafana/grafana:latest
如果权限不足运行chown 472:472 /home/prom/grafana -R
node-exporter:
docker run -d -p 9100:9100 -v /proc:/host/proc -v /sys:/host/sys -v /:/rootfs --net=host --restart=always prom/node-exporter --path.procfs /host/proc --path.sysfs /host/sys --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
cadvisor(docker-exporter):
docker run -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /var/lib/docker:/var/lib/docker:ro -p 8080:8080 --detach=true --name=cadvisor --net=host google/cadvisor
redis-exporter:
docker run -d -h redis_exporter --name redis_exporter --network trust139 --ip=10.1.139.218(redis的IP) -m 8g --cpus=4 oliver006/redis_exporter --redis.passwd 123456(redis密码)
mysql-exporter:
docker run -d --name mysql_exporter --restart always -p 9104:9104 -e DATA_SOURCE_NAME="user(用户名):password(密码)@(my-mysql-network:3306)/" prom/mysqld-exporter
oracle-exporter:
docker run -d –name oracledb_exporter –link=oracle -p 9161:9161 -e DATA_SOURCE_NAME=system(用户名)/oracle(密码)@oracle/xe iamseth/oracledb_exporter
jmx_exporter:
docker run -v [pathToYourConfig]:/opt/jmx_export/config/jmx_exporter.yml -P etraveli/jmx_exporter
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。