温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何使用prometheus和grafana监控Kubernetes

发布时间:2020-06-17 15:32:42 来源:亿速云 阅读:181 作者:元一 栏目:云计算

机器 : 172.27.143.155 

prometheus 介绍:

Prometheus是一个开源的系统监控和报警工具包,普罗米修斯在2016年加入了云原生计算基金会,成为继Kubernetes之后的第二个项目。

主要特征是:

多维数据模型,时间序列数据由度量名称和键/值对标识

PromQL是一种灵活的查询语言,可以利用这种维度

不依赖分布式存储;单个服务器节点是自治的

时间序列收集通过HTTP上的拉模型进行

通过中间网关支持时间序列的推送

通过服务发现或静态配置发现目标

多种模式的绘图和仪表板的支持

一、Prometheus安装:

1、wget https://github.com/prometheus/prometheus/releases/download/v2.8.1/prometheus-2.8.1.linux-amd64.tar.gz

2、tar -zxvf prometheus-2.8.1.linux-amd64.tar.gz -C /usr/local/

3、cd /usr/local
4、mv prometheus-2.8.1.linux-amd64/ prometheus
5、cd prometheus/
6、查看版本
./prometheus --version
如何使用prometheus和grafana监控Kubernetes
7、修改配置文件
prometheus.yml
如何使用prometheus和grafana监控Kubernetes

8、完成之后做成service服务
vim /lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=root

ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/home/software/prometheus-data
Restart=on-failure

[Install]
WantedBy=multi-user.target
如何使用prometheus和grafana监控Kubernetes

然后启动就可以了
然后验证
systemctl start prometheus
http://172.27.143.155:9090/targets
如何使用prometheus和grafana监控Kubernetes

二、安装grafana
1、https://grafana.com/grafana/download
2、wget https://dl.grafana.com/oss/release/grafana-6.5.2.linux-amd64.tar.gz
3、tar -zxvf grafana-6.5.2.linux-amd64.tar.gz
4、mv grafana-6.5.2  /usr/local/grafana
5、cd /usr/local/grafana/bin
6、nohup ./grafana-server &
http://172.27.143.155:3000/
账号和密码默认都是admin
7、配置数据源,这里时Prometheus
如何使用prometheus和grafana监控Kubernetes

8、导入模板ID号时193
如何使用prometheus和grafana监控Kubernetes
9、完成之后可以查看效果
如何使用prometheus和grafana监控Kubernetes

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI