- 下载地址
https://github.com/oliver006/redis_exporter/releases
- 启动
为了方便辨认 我更改了它的端口,并编了./start.sh
和./stop.sh
两个脚本方便以后启动,语句如下:
vim ./start.sh
nohup ./redis_exporter -redis.addr host:ip > ./startlog.log 2>&1 &
vim ./stop.sh
#!/bin/sh
echo "stop"
#!/bin/bash
PID=$(ps -ef | grep redis_exporter | grep -v grep | awk '{ print $2 }')
if [ "${PID}" ]
then
echo 'Application is stpping...'
echo kill $PID DONE
kill $PID
else
echo 'Application is already stopped...'
fi
- 配置prometheus
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
static_configs:
- targets: ["127.0.0.1:9090"]
#labels:
#instance: prometheus
- job_name: redis
static_configs:
- targets: ['127.0.0.1:9121']
#labels:
#instance: redis