Given the recent research tool just in terms of monitoring, so with this build essay. Given that essay, so in some places did not explain in detail, the latter will gradually make up, just to write a how to build.
A. Pre-planning and preparation
1. Software Installation Planning
Between individual virtual machines only 2,
So arrangements:
172.16.16.80
All the exporter on arrangements + prometheus + grafana
172.16.16.74
Stand-alone installation redis
And nginx
2. Software acquisition
Links: https://pan.baidu.com/s/1u1OjTQctdhZU3M-tqnckFQ extraction code: iy8n
Which contains the
prometheus, responsible for collecting exporter indicators and provide query
node_exporter, monitoring host performance such as memory, cpu, etc.
redis_exporter, monitoring redis
black_box_exporter, providing icmp; get, post detection modules page
grafana - visual display
. Need to achieve two objectives:
1. Host monitoring and display
2.redis monitoring and display
3. Monitoring one page, host address, Tcp connection and display
Three .node_exporter + prometheus + grafana structures
prometheus
1.tar -xvf prometheus-2.10.0.linux-amd64.tar.gz
2.vi prometheus.yml
3.
Here we must pay attention to .yml file format problems. Or will be error, since this is a direct copy of my own so the following configuration should pay attention to this formatting problems
scrape_configs:
- job_name: 'node_exporter'
metrics_path: "/metrics"
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
- targets: ['localhost:9100']
贴图:
4.nohup ./prometheus &
node_exporter
1.tar -xvf node_exporter-0.18.1.linux-amd64.tar.gz
2.nohup ./node_exporter &
3.tail -f nohup.out
4.测试:curl http://172.16.16.80:9100/metrics
有返回就正常OK。或者浏览器带端口9100访问
5.http://172.16.16.80:9090/targets 进去查看exporter状态
这样就配置好了。
grafana
1.配置数据源
2.展示:
Dashboard建立一个模板
add query
选择数据源
输入指标:node_load5{instance="localhost:9100"} / on (instance) count(count(node_cpu_seconds_total{instance="localhost:9100"}) by (instance,cpu))by(instance) * 100
3.关于指标的问题只能自己搜索是咋用。而且指标只要访问9100这个端口都能看得到。后期会专门写一下常用的指标和grafana的一些用法
4.关于指标的使用个人用类似html标签理解,指标名称+各种属性过滤数据 node_load5{instance="localhost:9100"}