监控组件Prometheus安装配置

监控组件普罗米修斯Prometheus

Prometheus是Google BorgMon监控系统的开源版本。伴随着容器及Kubernetes技术的兴起,Prometheus越来越受到大家的关注。

Prometheus下载地址:

https://prometheus.io/download/

Prometheus服务端安装

下载服务端

wget -c https://github.com/prometheus/prometheus/releases/download/v2.15.2/prometheus-2.15.2.linux-amd64.tar.gz
tar -zxvf prometheus-2.15.2.linux-amd64.tar.gz -C /usr/local/

主要文件

  • prometheus.yml --主配置文件
  • prometheus --启动脚本

启动服务端

./prometheus --config.file=prometheus.yml --storage.tsdb.path=data/

添加用户

groupadd -r prometheus
useradd  -r -g prometheus -s /sbin/nologin prometheus

编辑服务单元配置

[Unit]
Description=Prometheus monitor Server
Documentation=/usr/local/prometheus-2.15.2.linux-amd64/prometheus --help
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target 

[Install]
WantedBy=multi-user.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/prometheus-2.15.2.linux-amd64/prometheus --config.file=/usr/local/prometheus-2.15.2.linux-amd64/prometheus.yml --storage.tsdb.path=/usr/local/prometheus-2.15.2.linux-amd64/data/
Restart=on-failure

通过服务单元进行启动

systemctl daemon-reload
systemctl start prometheus

访问服务端UI界面

http://ipAddr:9090

Prometheus支持多语言客户端,可对核心业务进行埋点
一些主流应用可以通过官方或第三方的导出器,来对这些应用做核心指标的收集例如Redis和MySQL等等
prometheus同样也支持系统和网络相关的exporter方便服务器资源的监控

下载并启动node_exporter监控服务器资源

wget -c https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar -zxvf node_exporter-0.18.1.linux-amd64.tar.gz -C /usr/local
./node_exporter

服务器编辑prometheus.yml添加node地址

- job_name: 'node_localhost'
 static_configs:
 - targets: ['localhost:9100']

重新启动服务端

systemctl restart prometheus

安装grafana

grafana下载地址

https://grafana.com/grafana/download

dashboard下载地址

https://grafana.com/grafana/dashboards

插件下载地址

https://grafana.net/plugins/

wget -c https://dl.grafana.com/oss/release/grafana-6.1.4-1.x86_64.rpm
yum localinstall grafana-6.1.4-1.x86_64.rpm
systemctl start grafana-server

导入方式

      Grafana首页–>左上角图标–>Dashboard–>import

      加入1-node-exporter-0-16-0-17-for-prometheus_rev7.json这个插件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值