当前位置: 首页 > news >正文

常见的网站布局结构注册网站页面跳转错误

常见的网站布局结构,注册网站页面跳转错误,网站编辑适不适合男生做,网站建设项目前分析监控指标设置 使用 prometheus-cpp 进行监控指标设置,这里以 mqtt-server 的活跃连接数为例,统计四种协议类型的活跃连接数,在接收到连接进行连接数加一,连接断开时进行连接数减一,使用 gauge 类型 #pragma once#inc…

监控指标设置

使用 prometheus-cpp 进行监控指标设置,这里以 mqtt-server 的活跃连接数为例,统计四种协议类型的活跃连接数,在接收到连接进行连接数加一,连接断开时进行连接数减一,使用 gauge 类型

#pragma once#include <unordered_map>#include "metrics/IMetrics.h"class MqttConnMetrics : public IMetrics {
public:void register_metrics(prometheus::Registry& registry) override {auto& family = prometheus::BuildGauge().Name("mqtt_active_connections").Help("Number of active MQTT connections").Register(registry);protocol_gauges_ = {{MQTT_PROTOCOL::MQTT, &family.Add({{"protocol", "mqtt"}})},{MQTT_PROTOCOL::MQTTS, &family.Add({{"protocol", "mqtts"}})},{MQTT_PROTOCOL::WS, &family.Add({{"protocol", "ws"}})},{MQTT_PROTOCOL::WSS, &family.Add({{"protocol", "wss"}})}};is_registered_ = true;}void increment(MQTT_PROTOCOL protocol) {if (!is_registered_) return;protocol_gauges_[protocol]->Increment();}void decrement(MQTT_PROTOCOL protocol) {if (!is_registered_) return;protocol_gauges_[protocol]->Decrement();}private:bool is_registered_ = false;std::unordered_map<MQTT_PROTOCOL, prometheus::Gauge*> protocol_gauges_;
};

开发完成后,可以通过 http://<address>:<port>/metrics 路径访问到所有的监控指标

prometheus 采集监控指标

安装好 prometheus 之后修改一下 prometheus.yml 配置中 采集的目的地址

# my global config
global: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 configuration
alerting: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: "mqtt-server"scrape_interval: 1s# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["localhost:8085"]

启动后访问 prometheus 界面,检查是否成功采集到,默认地址 http://localhost:9090

grafana 展示监控数据

安装完 grafana 之后,进入界面添加 prometheus 数据源,然后新增仪表盘,配置监控指标等

http://www.yayakq.cn/news/382879/

相关文章:

  • 社交网站 模板重庆市建设工程信息网络
  • 有没有什么做水利资料的网站gooood谷德设计网官网
  • 三亚做网站推广舟山公司网站制作
  • 网站域名名字wordpress怎么管理首页侧边栏
  • php网站模板下载北京装饰公司一览表
  • 扁平化网站源码wordpress 页面路径
  • 深圳优化网站方法怎么做多个网站单点登录
  • 展示型网站 带后台小程序开发公司主页制作标准
  • 爱站网关键词排名会员管理软件
  • 网站建设与管理的网页为网站制定一个推广计划
  • 网站制作方案答案是螃蟹的迷语一流的盐城网站建设
  • 福山区建设工程质量检测站网站制作房地产网站页面
  • 上海网站开发定制下载软件的网站推荐
  • 注册一个公司需要哪些资料情感网站seo
  • 简单网站开发流程图高明做网站
  • 服务号不认证可做微网站吗公司招聘信息
  • 惠阳网站建设微信小商店如何推广
  • 口碑好的徐州网站建设新昌网站制作
  • 广 做网站蓝光电影下载大型视频网站开发
  • 查公司的网站有哪些有全部公司的网站
  • 关于门户网站建设的请示富阳网站建设推广
  • 微网站开发软件万网云服务器怎么上传网站
  • 天津建设部网站保温急切网
  • 福建漳州网站建设费用柳州门户网站建设公司排名
  • 太仓企业网站建设我想创业做网站
  • 公司网站做推广豆浆怎么制作教程
  • 购物帮–做特惠的导购网站wordpress整合教程
  • 模板式网站价格阿里巴巴官网首页
  • 广州建设交易中心网站wordpress 婚礼主题
  • 网站查询进入wordpress 多站点配置文件