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.附 ...
随机推荐
- 【ybtoj】贪心算法例题
[基础算法]第二章 贪心算法 例一 奶牛晒衣服 题目描述 有n件衣服,第i件衣服的湿度为h. 在自然条件下,每件衣服每分钟都可以自然晒干A点湿度. 在烘干机作用下,可以选择一件衣服,用一分钟的时间晒干 ...
- 有个姑娘叫history
文章目录 常用参数 history的一些用法 修改history命令默认保存的数量 来给history穿衣服 让我们重新认识一下history history命令用于显示用户以前执行过的历史命令,并且 ...
- 如何使用IDEA工具右边栏的Database模块
理解Spring Boot自动配置数据源相关代码进行测试时总是无法链接数据库,但是其他方式链接又是没有问题.不知道哪里出现问题了,后来搜资料无意中看到idea提供了Database模块可以测试,就是用 ...
- JSP中引入JQuery和Layer,浏览器控制台报错404
路径没有写错,文件也存在为什么会报404呢?,解决方法是将layer文件夹使用source的方式 解决办法: 这时候你会发现layer文件夹变成了蓝色,重启一次服务器,页面中就没有报404异常了 总结 ...
- 如何在3D场景中在模型上面绘制摄取点
有些时候,我们在屏幕上面绘制一个摄取点,在单屏玩游戏的模式下,我们并不能觉得有什么不妥.但是最近VR的热火朝天,我们带上眼镜看双屏的时候,总觉得这个摄取点看着很不舒服. 这个问题该怎么解决?在这里我首 ...
- 用eclipse写jsp报以下错误
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ tag ...
- 对于计算正确率时 logits.argmax(dim=1),torch.eq(pre_label,label)
额 好像是一句非常简单的代码 ,但是作为新手 ,我是完全看不懂哎 前十眼. 首先 这里的logits是一个 (a,b)维的张量.其中a是你的全连接输出维度,b是一个batch中的样本数量. 我们经过 ...
- cpu 时间片消耗表|cpu消耗表
1秒=1000毫秒(ms)=1,000,000 微秒(μs)=1,000,000,000 纳秒(ns)=1,000,000,000,000 皮秒(ps) 1个CPU时钟周期=时钟频率 2GHz CPU ...
- 如何在github上准确的搜索 项目
1.按名字搜索:in:name 1. 2.in:name wpf stars:>100 2.按 in:readme wpf stars:>100 3.按描述搜索 in:descripti ...
- 关于UI自动化IOS元素定位方法说明
1. 元素属性介绍 下图是通过weditor定位的微博的"我的钱包",各属性如下图: className:元素类型,如:XCUIElementTypeButton isEnable ...