Prometheusbu部署使用-1
Prometheus+grafana部署使用
主机列表:
192.168.161.130 : Prometheus
192.168.161.128 : node-1
192.168.161.129 : node-2
二进制手动部署
解压 prometheus-2.14.0.linux-amd64.tar.gz包
解压放至 /usr/local下
- 编辑服务启动脚本
vim /usr/lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus server daemon
[Service]
ExecStart=/usr/local/prome/prometheus --config.file=/usr/local/prome/prometheus.yml
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
systemctl daemon-reload # 加载后台服务
systemctl start | stop | restart | status prometheus
服务端监控配置文件内容
global: # 全局配置段
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files: # 告警规则配置
scrape_configs: # 监控配置
- job_name: 'prometheus' #监控任务名称
static_configs: # 静态监控配置
- targets: ['192.168.235.130:9090']
labels:
node: prome_server
使用动态发现添加主机
global: # 全局配置段
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files: # 告警规则配置
scrape_configs: # 监控配置
- job_name: 'prometheus' #监控任务名称
# static_configs: # 静态监控配置
# - targets: ['192.168.235.130:9090']
# labels:
# node: prome_server
file_sd_configs: # 基于配置文件动态发现添加主机
- files: ['/usr/local/prome/sd_config/*.yml'] # 定义服务发现配置路径
refresh_interval: 5s # 5秒发现刷洗发现一次
- 创建服务发现配置文件
mkdir /usr/local/prome/sd_config
- 编辑prometheus监控程序的配置文件
- targets: # 直接指定动态发现下的 targets 目标主机
- 192.168.235.130:9090
labels: # 给目标主机添加标签标识
node: prome_server
- 重载服务
systemctl reload prometheus
被监控节点安装数据采集工具 node-exporter
- 解压
[root@localhost ~]# tar zxf node_exporter-0.18.1.linux-amd64.tar.gz
[root@localhost ~]# mv node_exporter-0.18.1.linux-amd64 /usr/local/
- 将服务做成系统服务管理运行
[Unit]
Description=Node_exporter server daemon
[Service]
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
prometheus添加远程主机监控
在原来的prometheus.yml中添加任务,监控远程主机
# my global config
global:
evaluation_interval: 15s
scrape_interval: 15s
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['192.168.235.130:9090']
labels:
node: prome_server
# file_sd_configs:
# - files: ['/usr/local/prome/sd_config/*.yml']
# refresh_interval: 5s
- job_name: 'node-1' # 添加主机node-1
static_configs:
- targets: ['192.168.235.128:9100']
labels:
node: node-1
- job_name: 'node-2' # 添加主机node-2
static_configs:
- targets: ['192.168.235.129:9100']
labels:
node: node-2
将node_exporter添加服务监控
node_exporter 还可以监控系统的服务状态,在启动是指定参数启用服务监控--collector.systemd --collector.systemd.unit-whitelist=服务名称
[Unit]
Description=Node_exporter server daemon
[Service]
ExecStart=/usr/local/node_exporter/node_exporter --collector.systemd --collector.systemd.unit-whitelist=(sshd|docker|nginx).service
Restart=on-failure
[Install]
WantedBy=multi-user.target
- --collector.systemd : 表示启用服务监控
- --collector.systemd.unit-whitelist=(sshd|docker|nginx).service : 表示监控多个服务
grafan中快速使用监控模板快速监控
grafana 提供了大量的监控模板,针对各种exporter和数据源制作了不同的监控模板,在grafana中导入即可直接使用
https://grafana.com/grafana/dashboards
- 通过监控模板的ID值直接导入
选择某个监控模板,找到Get this dashboard:的值,这里针对node-exporter的模板有一个比较好的模板ID:8919 ,可以快速实现主机资源的监控。
同样,容器监控也一样。找到合适的模板即可
Prometheusbu部署使用-1的更多相关文章
- [原]CentOS7.2部署node-mapnik
转载请注明表作者think8848及出处(http://think8848.cnblogs.com) node-mapnik依赖项中要求g++ >= 5, toolchain (>= GL ...
- 使用Visual Studio 2015 开发ASP.NET MVC 5 项目部署到Mono/Jexus
最新的Mono 4.4已经支持运行asp.net mvc5项目,有的同学听了这句话就兴高采烈的拿起Visual Studio 2015创建了一个mvc 5的项目,然后部署到Mono上,浏览下发现一堆错 ...
- 通过Jexus 部署 dotnetcore版本MusicStore 示例程序
ASPNET Music Store application 是一个展示最新的.NET 平台(包括.NET Core/Mono等)上使用MVC 和Entity Framework的示例程序,本文将展示 ...
- 结合Jexus + Kestrel 部署 asp.net core 生产环境
ASP.NET Core 是微软的全新的框架.这一框架的目标 ︰ 跨平台 针对云应用优化 解除 System.Web 的依赖. 获得下面三个方面的优势,你可以把它认为是一个C# 版本的NodeJS: ...
- 4.Windows Server2012 R2里面部署 MVC 的网站
网站部署之~Windows Server | 本地部署:http://www.cnblogs.com/dunitian/p/4822808.html#iis 后期会在博客首发更新:http://dnt ...
- Win10 IIS本地部署MVC网站时不能运行?
异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 部署后出现这个错误: 打开文件目录后发现是可以看见目录的,静态页面也是可以打开的 ...
- 再部署一个 instance 和 Local Network - 每天5分钟玩转 OpenStack(131)
上一节部署了 cirros-vm1 到 first_local_net,今天我们将再部署 cirros-vm2 到同一网络,并创建 second_local_net. 连接第二个 instance 到 ...
- 将 instance 部署到 OVS Local Network - 每天5分钟玩转 OpenStack(130)
上一节创建了 OVS 本地网络 first_local_net,今天我们会部署一个 instance 到该网络并分析网络结构.launch 一个 instance,选择 first_local_net ...
- 从零开始编写自己的C#框架(25)——网站部署
导航 1.关掉访问保护 2.发布网站 3.复制网站到服务器 4.添加新网站 5.设置网站访问权限 6.设置文件夹访问权限 7.控制可更新文件夹执行权限 8.设置“应用程序池”.net版本与模式 9.附 ...
随机推荐
- JVM调优——JVM监控工具jvisualvm的使用及GC插件安装
一.前言 在高并发的场景下,我们网站的的访问性能会降低,我们怎么优化,这是个问题!天天听JVM调优,实际上还是不知道怎么调优,调优也是看着网上说的修改一下JVM的堆的空间等等进行的.实际上我们应该在压 ...
- Spring的AOP的底层实现原理?
aop是ioc的一个扩展功能,先有的ioc,再有的aop,只是在ioc的整个流程中新增的一个扩展点而已:BeanPostProcessor 底层实现用的是动态代理 AOP应用场景 场景一: 记录日志 ...
- Linux C/C++ UDP 网络通信
昨晚 Vv 想让我给她讲讲网络编程,于是我就傻乎乎的带她入了门... 以下内容为讲课时制作的笔记- 1. socket() 函数 1.1 头文件 #include<sys/socket.h> ...
- SpringBoot 实现 excel 全自由导入导出,性能强的离谱,用起来还特优雅
一.简介 在实际的业务系统开发过程中,操作 Excel 实现数据的导入导出基本上是个非常常见的需求. 之前,我们有介绍一款非常好用的工具:EasyPoi,有读者提出在数据量大的情况下,EasyPoi ...
- MyBatis核心对象
MyBatis 有三个基本要素: 核心接口和类 MyBatis核心配置文件(mybatis-config.xml) SQL映射文件(mapper.xml) 下面首先介绍 MyBatis 的核心接口和类 ...
- Oracle数据库巡检
转至:https://blog.51cto.com/sf1314/2123068 select inst_id,status,count(*) from gv$session group by ins ...
- Could not load file or assembly 'System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
项目升级后提示错误 System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Ve ...
- Markdown语法浅学
typora语法使用 1.字体 *斜体*,_斜体_ **粗体** ***加粗斜体*** ~~删除线~~ <u>下划线</u> ***分割线 , --- 2.标题 # 一级标题 ...
- JZ-004-重建二叉树
重建二叉树 题目描述 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的前序遍历和中序遍历的结果中都不含重复的数字.例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序 ...
- [ Skill ] load 函数优化,识别相对路径
https://www.cnblogs.com/yeungchie/ 在 cds.lib 文件中定义库的路径,为了规范库定义的管理,经常这样做: . |-- cds.lib ------------- ...