1
jmx_prometheus方式监控zk指标
source link: https://blog.51cto.com/u_14068620/5714568
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
jmx_prometheus方式监控zk指标
精选 原创一、下载jmx_prometheus_javaagent和zookeeper.yaml
#下载jmx程序包
cd /usr/local/src/
wget https://raw.githubusercontent.com/prometheus/jmx_exporter/master/example_configs/zookeeper.yaml
wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.6/jmx_prometheus_javaagent-0.6.jar
#移动到zookeeper程序目录
mkdir /usr/local/zookeeper/prometheus/
mv zookeeper.yaml /usr/local/zookeeper/prometheus/
mv jmx_prometheus_javaagent-0.6.jar /usr/local/zookeeper/prometheus/
二、配置jmx_prometheus
cat > /usr/local/zookeeper/conf/java.env <<\EOF
export JMX_DIR="/usr/local/zookeeper/prometheus"
export SERVER_JVMFLAGS="-javaagent:$JMX_DIR/jmx_prometheus_javaagent-0.6.jar=9505:$JMX_DIR/zookeeper.yaml $SERVER_JVMFLAGS"
EOF
三、然后重启zookeeper
#服务停止
/usr/local/zookeeper/bin/zkServer.sh stop
#服务启动
/usr/local/zookeeper/bin/zkServer.sh start /usr/local/zookeeper/conf/zoo.cfg
#查看指标了
curl localhost:9505/metrics
四、修改prometheus配置
cat > /home/prometheus/prometheus.yml <<\EOF
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'zookeeper'
static_configs:
- targets: ['192.168.56.11:9505']
labels:
instance: 192.168.56.11_9505
EOF
#重启prometheus
docker restart prometheus
五、grafna导入视图
https://grafana.com/grafana/dashboards/9236
#注意使用在使用rate或者irate的时候,范围需要大于注意上报的最小时间间隔
rate(process_cpu_seconds_total{job="zookeeper"}[5m])
- 赞
- 收藏
- 评论
- 分享
- 举报
上一篇:Kafka单机配置部署
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK