标签:lookup elastics tps guide 指标 inux ecs 开源项目 本地存储
(一)、概述(二)、安装配置
一、Prometheust Server端安装和相关配置
1.1、二进制包安装
1.1、官网地址https://prometheus.io/download/
1.2、下载和安装
wget https://github.com/prometheus/prometheus/releases/download/v2.22.0-rc.0/prometheus-2.22.0-rc.0.linux-386.tar.gz
tar xf prometheus-2.22.0-rc.0.linux-386.tar.gz
mv prometheus-2.22.0-rc.0.linux-386/prometheus /usr/local/prometheus
1.3、配置系统启动文件
cat /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Server
After=network.target
Documentation=https://prometheus.io/docs/introduction/overview/
[Service]
Type=simple
WorkingDirectory=/data/prometheus/
ExecStart=/usr/local/prometheus/prometheus --config.file=/etc/prometheus/prometheus.yml --web.read-timeout=5m --web.max-connections=512 --storage.tsdb.retention=15d --storage.tsdb.path=/data/prometheus --query.timeout=2m
Restart=on-failure
[Install]
WantedBy=multi-user.target
1.4、把配置文件转移到标准目录/etc/prometheus/
mkdir -p /etc/prometheus/
cp /usr/local/prometheus/prometheus.yml /etc/prometheus/
cat /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
rule_files:
scrape_configs:
- job_name: ‘prometheus‘
static_configs:
- targets: [‘localhost:9090‘]
1.4、启动
systemctl daemon-reload
systemctl start prometheus
systemctl enable prometheus
systemctl status prometheus
1.5、查看通过 ip:9090进行查看。二进制安装非常方便,没有依赖,自动查询的web界面。配置了9090端口,默认prometheus会抓取自己的/metrics接口
1.2、docker安装
1、安装
docker run -p 9090:9090 -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
2、查看prometheus服务和状态
docker start prometheus
docker stop prometheus
docker stats prometheus
二、安装node_exporter提供metrics
1、下载、解压和移动
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
tar xf node_exporter-1.0.1.linux-amd64.tar.gz
mv node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/prometheus/
2、配置启动文件
cat /etc/systemd/system/node_export.service
[Unit]
Description=Node Export
After=network.target
Documentation=https://prometheus.io/docs/guides/node-exporter/
[Service]
Type=simple
WorkingDirectory=/tmp/
ExecStart=/usr/local/prometheus/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
3、自启动
[root@ES-Master2 opt]# systemctl start node_export
[root@ES-Master2 opt]# systemctl enable node_export
Created symlink from /etc/systemd/system/multi-user.target.wants/node_export.service to /etc/systemd/system/node_export.service.
[root@ES-Master2 opt]# systemctl status node_export
4、加入监控
手动加入 prometheus 监控,修改其配置文件,再尾部增加如下内容:
- job_name: elasticsearch
scrape_interval: 60s
scrape_timeout: 30s
metrics_path: "/metrics"
static_configs:
- targets: [172.20.3.201:9100]
labels:
service: elasticsearch
然后重新载入配置curl -X POST http://localhost:9090/-/reload
5、查看生效的接口
6、docker安装更简单
docker run -d --net="host" --pid="host" -v "/:/host:ro,rslave" quay.io/prometheus/node-exporter --path.rootfs=/host
三、安装grafana进行展示
Grafana是用于可视化大型测量数据的开源程序,它提供了强大和优雅的方式去创建、共享、浏览数据。
Dashboard中显示了你不同metric数据源中的数据。
Grafana最常用于因特网基础设施和应用分析,但在其他领域也有用到,比如:工业传感器、家庭自动化、过程控制等等。
Grafana支持热插拔控制面板和可扩展的数据源,目前已经支持Graphite、InfluxDB、OpenTSDB、Elasticsearch、Prometheus等。
1、下载地址 https://grafana.com/grafana/download
2、Red Hat, CentOS, RHEL, and Fedora(64 Bit)
wget https://dl.grafana.com/oss/release/grafana-7.2.1-1.x86_64.rpm
sudo yum install grafana-7.2.1-1.x86_64.rpm -y
3、自启动
systemctl enable grafana-server
systemctl start grafana-server
4、访问ip:3000端口,默认账号和密码都是admin:admin
标签:lookup elastics tps guide 指标 inux ecs 开源项目 本地存储
原文地址:https://blog.51cto.com/liqingbiao/2541902