Promethues+grafana监控方案部署

2023-10-11 01:58

本文主要是介绍Promethues+grafana监控方案部署,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

主机:192.168.68.127
OS:Centos 7.6
1、下载部署prometheus所需要文件包并部署安装

cd /usr/local/src/
wget -c https://github.com/prometheus/prometheus/releases/download/v2.17.1/prometheus-2.22.1.darwin-amd64.tar.gz
mv prometheus-2.17.1.linux-amd64 /usr/local/prometheuscd /usr/local/prometheus/#添加用户,并赋权groupadd prometheus
useradd -g prometheus -s /sbin/nologin prometheus
mkdir -p /var/lib/prometheus
chown -R prometheus:prometheus /var/lib/prometheus/
touch /usr/lib/systemd/system/prometheus.service
chown prometheus:prometheus /usr/lib/systemd/system/prometheus.service
[root@node1 prometheus]# vim /usr/lib/systemd/system/prometheus.service 
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
# Type设置为notify时,服务会不断重启
Type=simple
User=prometheus
# --storage.tsdb.path是可选项,默认数据目录在运行目录的./dada目录中
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus
Restart=on-failure[Install]
WantedBy=multi-user.targetsystemctl enable prometheus
systemctl start prometheus

查看确认,验证服务运行

netstat -ntlp
systemctl status prometheus

在这里插入图片描述在这里插入图片描述
Prometheus 自带的UI登录:
http://192.168.68.127:9090
在这里插入图片描述

在Status菜单下,Statu–>Configuration展示prometheus.yml的配置,如下:
在这里插入图片描述

2、下载node_exporter文件包并部署安装
Node_exporter收集机器的系统数据,这里采用prometheus官方提供的exporter,除node_exporter外,官方还提供consul,memcached,haproxy,mysqld等exporter

cd /usr/local/src/
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.0/node_exporter-1.0.0.linux-amd64.tar.gz
tar -xf node_exporter-1.0.0-rc.0.linux-amd64.tar.gz 
mv node_exporter-1.0.0-rc.0.linux-amd64 /usr/local/node_exporter
chown -R prometheus:prometheus /usr/local/node_exporter/

设定开机启动

vim /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure[Install]
WantedBy=multi-user.targetsystemctl enable node_exporter
systemctl start node_exporter

验证:
在这里插入图片描述

3、下载grafana文件包安装部署

cd /usr/local/src/
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-6.2.0-1.x86_64.rpm
yum localinstall grafana-4.6.2-1.x86_64.rpm
systemctl enable grafana-server
systemctl start grafana-server

在这里插入图片描述

添加数据
登录
http://192.168.68.127:3000
默认账号/密码:admin/admin
在这里插入图片描述
在这里插入图片描述

添加数据:
在登陆首页,点击"Add data source"按钮,跳转到添加数据源页面,配置如下:
Name: prometheus
Type: prometheus
URL: http://localhost:9090/
Access: proxy或Server(Default)
取消Default的勾选,其余默认,点击"Add",如下:
在这里插入图片描述

在"Dashboards"页签下"import"自带的模版,如下:
在这里插入图片描述

从grafana官网下载相关的dashboad到本地,然后Grafana-左上角-Dashboard->Import即可。

这篇关于Promethues+grafana监控方案部署的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/184693

相关文章

通过Docker容器部署Python环境的全流程

《通过Docker容器部署Python环境的全流程》在现代化开发流程中,Docker因其轻量化、环境隔离和跨平台一致性的特性,已成为部署Python应用的标准工具,本文将详细演示如何通过Docker容... 目录引言一、docker与python的协同优势二、核心步骤详解三、进阶配置技巧四、生产环境最佳实践

Nginx部署HTTP/3的实现步骤

《Nginx部署HTTP/3的实现步骤》本文介绍了在Nginx中部署HTTP/3的详细步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学... 目录前提条件第一步:安装必要的依赖库第二步:获取并构建 BoringSSL第三步:获取 Nginx

MyBatis Plus实现时间字段自动填充的完整方案

《MyBatisPlus实现时间字段自动填充的完整方案》在日常开发中,我们经常需要记录数据的创建时间和更新时间,传统的做法是在每次插入或更新操作时手动设置这些时间字段,这种方式不仅繁琐,还容易遗漏,... 目录前言解决目标技术栈实现步骤1. 实体类注解配置2. 创建元数据处理器3. 服务层代码优化填充机制详

防止Linux rm命令误操作的多场景防护方案与实践

《防止Linuxrm命令误操作的多场景防护方案与实践》在Linux系统中,rm命令是删除文件和目录的高效工具,但一旦误操作,如执行rm-rf/或rm-rf/*,极易导致系统数据灾难,本文针对不同场景... 目录引言理解 rm 命令及误操作风险rm 命令基础常见误操作案例防护方案使用 rm编程 别名及安全删除

Python实现批量CSV转Excel的高性能处理方案

《Python实现批量CSV转Excel的高性能处理方案》在日常办公中,我们经常需要将CSV格式的数据转换为Excel文件,本文将介绍一个基于Python的高性能解决方案,感兴趣的小伙伴可以跟随小编一... 目录一、场景需求二、技术方案三、核心代码四、批量处理方案五、性能优化六、使用示例完整代码七、小结一、

C#使用Spire.Doc for .NET实现HTML转Word的高效方案

《C#使用Spire.Docfor.NET实现HTML转Word的高效方案》在Web开发中,HTML内容的生成与处理是高频需求,然而,当用户需要将HTML页面或动态生成的HTML字符串转换为Wor... 目录引言一、html转Word的典型场景与挑战二、用 Spire.Doc 实现 HTML 转 Word1

使用Python实现Word文档的自动化对比方案

《使用Python实现Word文档的自动化对比方案》我们经常需要比较两个Word文档的版本差异,无论是合同修订、论文修改还是代码文档更新,人工比对不仅效率低下,还容易遗漏关键改动,下面通过一个实际案例... 目录引言一、使用python-docx库解析文档结构二、使用difflib进行差异比对三、高级对比方

redis-sentinel基础概念及部署流程

《redis-sentinel基础概念及部署流程》RedisSentinel是Redis的高可用解决方案,通过监控主从节点、自动故障转移、通知机制及配置提供,实现集群故障恢复与服务持续可用,核心组件包... 目录一. 引言二. 核心功能三. 核心组件四. 故障转移流程五. 服务部署六. sentinel部署

springboot2.1.3 hystrix集成及hystrix-dashboard监控详解

《springboot2.1.3hystrix集成及hystrix-dashboard监控详解》Hystrix是Netflix开源的微服务容错工具,通过线程池隔离和熔断机制防止服务崩溃,支持降级、监... 目录Hystrix是Netflix开源技术www.chinasem.cn栈中的又一员猛将Hystrix熔

Python多线程应用中的卡死问题优化方案指南

《Python多线程应用中的卡死问题优化方案指南》在利用Python语言开发某查询软件时,遇到了点击搜索按钮后软件卡死的问题,本文将简单分析一下出现的原因以及对应的优化方案,希望对大家有所帮助... 目录问题描述优化方案1. 网络请求优化2. 多线程架构优化3. 全局异常处理4. 配置管理优化优化效果1.