centos安装Prometheus
发布日期:2021-06-30 20:51:29 浏览次数:2 分类:技术文章

本文共 1662 字,大约阅读时间需要 5 分钟。

本文转载运维@小兵 原文地址:

https://blog.csdn.net/anqixiang/article/details/104166077

一、简介

1架构图

在这里插入图片描述
2、核心概念
在这里插入图片描述

二、安装配置和使用

下载二进制包并解压

官方地址:https://github.com/prometheus/prometheus/tags
**百度网盘 :**链接:https://pan.baidu.com/s/1og-EH5nxG9xX6ndVI-Gogg
提取码:q5in

tar xvf prometheus-2.14.0.linux-amd64.tar.gzmv prometheus-2.14.0.linux-amd64 /usr/local/bin/prometheus

配置systemd管理

cat > /usr/lib/systemd/system/prometheus.service << EOF[Unit]Description=https://prometheus.io[Service]Restart=on-failureExecStart=/usr/local/bin/prometheus/prometheus --config.file=/usr/local/bin/prometheus/prometheus.yml[Install]WantedBy=multi-user.targetEOF

systemctl daemon-reload

systemctl start prometheus
systemctl enable prometheus

2.web访问(默认监控自身)

访问地址:http://ip:9090
在这里插入图片描述
3.查看当前抓取的数据

http://IP:9090/metrics

在这里插入图片描述
4.查找数据,示例
访问地址:http://ip:9090
在这里插入图片描述
在这里插入图片描述
可以看到统计的数据

在这里插入图片描述

图形化展示

在这里插入图片描述

三、docker方式部署(没试验出来呢,卡在了02.拉取镜像)

1安装docker

wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repoyum install docker-ce-18.06.1.ce-3.el7 -ysystemctl enable dockersystemctl start dockerdocker -v

2拉取镜像启动容器

配置国内镜像源,提高下载速度:https://blog.csdn.net/anqixiang/article/details/96772479

docker run -d --name prometheus --restart=always -p 9090:9090 -v /usr/local/bin/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

访问http://ip:9090

四、配置文件讲解

在这里插入图片描述

1、global全局配置

scrape_interval		采集数据周期,默认1分钟scrape_timeout		采集超时时间,默认10秒evaluation_interval	告警评估周期,默认1分钟external_labels		外部标签,很少用

2、rule_files指定监控告警规则

参考:https://www.jianshu.com/p/fb5c82de935d
在这里插入图片描述

metrics_path		默认为/metricshonor_labels		默认标签值,默认不覆盖scheme:				请求的协议,默认httpparams:				http携带的参数basic_auth			基础认证

4.alerting配置告警

5.remote_write远程存储写
6.remote_read远程存储读

转载地址:https://liushiya.blog.csdn.net/article/details/104349203 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:ssh远程连接的问题
下一篇:ulimit命令以及修改进程limits的方法【转载】

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月27日 09时17分34秒