分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

.NetCore下使用Prometheus实现系统监控和警报 (二)Linux安装

发布时间:2023-09-06 02:21责任编辑:郭大石关键词:Linux

Prometheus对Windows有相关的支持  下载地址:https://prometheus.io/download/

wget https://github.com/prometheus/prometheus/releases/download/v2.5.0/prometheus-2.5.0.linux-amd64.tar.gz

如果需要也可以下载其他组件支持

解压安装:

tar -xvf prometheus-2.5.0.linux-amd64.tar.gz

查看配置:cd /目录查看配置

 cd prometheus-2.5.0.linux-amd64

配置如下:

# my global configglobal: ?scrape_interval: ???15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. ?evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. ?# scrape_timeout is set to the global default (10s).# Alertmanager configurationalerting: ?alertmanagers: ?- static_configs: ???- targets: ?????# - alertmanager:9093# Load rules once and periodically evaluate them according to the global ‘evaluation_interval‘.rule_files: ?# - "first_rules.yml" ?# - "second_rules.yml"# A scrape configuration containing exactly one endpoint to scrape:# Here it‘s Prometheus itself.scrape_configs: ?# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. ?- job_name: ‘prometheus‘ ???# metrics_path defaults to ‘/metrics‘ ???# scheme defaults to ‘http‘. ???static_configs: ???- targets: [‘localhost:9090‘]~ ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????~ ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????~ ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????~ ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"prometheus.yml" 29L, 925C ?

scrape_interval:收集频率

evaluation_interval:分析评率

alerting:预警相关设置

scrape_configs:分析配置,static_configs中要特别说明下收集目标,targets:[localhost:9090] 这里是数组 可以配置多个

注意:这里跟前面的 InfluxDB+AppMetrics 不一样,AppMetrics是在应用程序中去主动推送分析数据到 InfluxDB,而Prometheus是通过targets配置的地址去获取,但是在应用程序端也需要使用客户端中间件处理下

这里默认收集localhost:9090

下面我们后台启动下Prometheus,可以指定配置启动

./prometheus --config.file=prometheus.yml &

在打开9090端口测试下:

firewall-cmd --zone=public --add-port=9090/tcp --permanentfirewall-cmd --reload

浏览下

可以选择指定的分析指标

选择一个指标查询看下

我们也可以通过图表看查看分析情况,并添加添加多个图表分析

当然还有一些额外的处理,比如监控节点展示、服务发现等其他细节用法参考官方文档

  



 


.NetCore下使用Prometheus实现系统监控和警报 (二)Linux安装

原文地址:https://www.cnblogs.com/liyouming/p/9930055.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved