.net core使用App.Metrics+InfluxDB+Grafana进行APM监控
一、InfluxDB
1、下载InfluxDB
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.5.2.x86_64.rpm
2、安装InfluxDB
rpm -ivh influxdb-1.5..x86_64.rpm
systemctl start influxdb.service
3、创建库、用户
influx
CREATE DATABASE qkaweb
use qkaweb
create user "leizhihui" with password ''
二、Grafana
1、下载、安装:
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.2-1.x86_64.rpm
yum localinstall grafana-5.1.-.x86_64.rpm
2、设置开机自动启动:
systemctl daemon-reload
systemctl enable grafana-server.service
3、启动服务并查看服务状态:
systemctl start grafana-server.service
systemctl status grafana-server.service
4、访问ip+3000端口,用户名和密码均为admin进行登录,
5、创建数据源,如下图所示:

6、导入Dashboard:


输入2125后点击Import按钮即导入App Metrics模板。
三、网关项目中添加App Metrics
1、添加下面nuget引用:
App.Metrics
App.Metrics.Extensions.Middleware
App.Metrics.Extensions.Mvc
App.Metrics.Extensions.Reporting.InfluxDB
App.Metrics.Extensions.Middleware
App.Metrics.Formatters.Json
2、修改appsettings.json文件:
"AppMetrics": {
"DataBaseName": "qkaweb",
"ConnectionString": "http://192.168.2.168:8086",
"UserName": "leizhihui",
"Password": "123456",
"App": "QkaWebApis",
"Env": "develop"
}
3、添加如下代码:
public void ConfigureServices(IServiceCollection services)
{ #region App Metrics
AppMetricsConfig appMetricsConfig = Configuration.GetSection("AppMetrics").Get<AppMetricsConfig>();
var uri = new Uri(appMetricsConfig.ConnectionString); var metrics = AppMetrics.CreateDefaultBuilder()
.Configuration.Configure(
options =>
{
options.AddAppTag(appMetricsConfig.App);
options.AddEnvTag(appMetricsConfig.Env);
})
.Report.ToInfluxDb(
options =>
{
options.InfluxDb.BaseUri = uri;
options.InfluxDb.Database = appMetricsConfig.DataBaseName;
options.InfluxDb.UserName = appMetricsConfig.UserName;
options.InfluxDb.Password = appMetricsConfig.Password;
options.HttpPolicy.BackoffPeriod = TimeSpan.FromSeconds();
options.HttpPolicy.FailuresBeforeBackoff = ;
options.HttpPolicy.Timeout = TimeSpan.FromSeconds();
options.FlushInterval = TimeSpan.FromSeconds();
})
.Build(); services.AddMetrics(metrics);
services.AddMetricsReportScheduler();
services.AddMetricsTrackingMiddleware();
services.AddMetricsEndpoints();
#endregion
} public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMetricsAllMiddleware();
app.UseMetricsAllEndpoints();
}
.net core使用App.Metrics+InfluxDB+Grafana进行APM监控的更多相关文章
- .NET Core微服务之基于App.Metrics+InfluxDB+Grafana实现统一性能监控
Tip: 此篇已加入.NET Core微服务基础系列文章索引 一.关于App.Metrics+InfluxDB+Grafana 1.1 App.Metrics App.Metrics是一款开源的支持. ...
- 基于.net core微服务(Consul、Ocelot、Docker、App.Metrics+InfluxDB+Grafana、Exceptionless、数据一致性、Jenkins)
1.微服务简介 一种架构模式,提倡将单一应用程序划分成一组小的服务,服务之间互相协调.互相配合,为用户提供最终价值.每个服务运行在其独立的进程中,服务与服务间采用轻量级的通信机制互相沟通(RESTfu ...
- .NET Core使用App.Metrics监控消息队列(一):初探
一.简介 App Metrics是一个开放源代码和跨平台的.NET库,用于记录应用程序中的指标.App Metrics可以在.NET Core或也支持.NET 4.5.2的完整.NET框架上运行. A ...
- Telegraf+InfluxDB+Grafana搭建服务器监控平台
Telegraf+InfluxDB+Grafana搭建服务器监控平台 tags:网站 个人网站:https://wanghualong.cn/ 效果展示 本站服务器状态监控:https://statu ...
- Docker系列——InfluxDB+Grafana+Jmeter性能监控平台搭建(三)
在之前系列博文中,已经介绍完了数据采集和数据存储,那数据如何展示呢?所以今天就专门来讲下数据如何展示的问题. 以前博文参考: Docker系列--InfluxDB+Grafana+Jmeter性能监控 ...
- [转帖] 基于telegraf, influxdb, grafana 建立 esxi 监控
[系统集成] 基于telegraf, influxdb, grafana 建立 esxi 监控 https://www.cnblogs.com/hahp/p/7677420.html 之前在 nagi ...
- Docker系列——InfluxDB+Grafana+Jmeter性能监控平台搭建(一)
在做性能测试的时候,重点关注点是各项性能指标,用Jmeter工具,查看指标数据,就是借助于聚合报告,但查看时也并不方便.那如何能更直观的查看各项数据呢?可以通过InfluxDB+Grafana+Jme ...
- [系统集成] 基于telegraf, influxdb, grafana 建立 esxi 监控
之前在 nagios 上建立了 esxi 监控,指标少.配置麻烦.视觉效果差.最近我把 esxi 监控迁移到了 influxdb+grafana 平台上,无论是监控指标.可操作性还是视觉效果都有了很大 ...
- collectd+influxDB+Grafana搭建性能监控平台
网上查看了很多关于环境搭建的文章,都比较久远了很多安装包源都不可用了,今天收集了很多资料组合尝试使用新版本来搭建,故在此记录. 采集数据(collectd)-> 存储数据(influxdb) - ...
随机推荐
- asp.net core选项配置的研究
asp.net-core选项模块是全新,可拓展的框架,其作用在整个.net-core框架中,就像依赖注入一样无处不在,是一个很重要的组件. 其实配置模块与选项模块是紧密相连的,我们可以使用Config ...
- 百度编辑器上传视频音频的bug
前言:UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码,百度Ueditor 支持多种后台语言上传 ...
- 代码托管工具 git
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545 } p. ...
- django2.0升级日记
1.大量的外键定义需要加on_delete参数 2.'WSGIRequest' object has no attribute 'session',这个问题是因为settings中middleware ...
- iOS9自动布局神器StackView
http://www.jianshu.com/p/767f72b7d754 这篇文章紧跟上边autolayout的一些小技巧,如果你没有看过,不防先看下<你真的会用autolayout吗?> ...
- Getting Real内容浓缩
今天看完,想整理一下,可能会更好,也给别人提供一个快速学习的途径第一章 什么是 Getting Real?表达形式省略.精炼.精益.敏捷.用户体验.迭代改进.产品简化.第二章 建构从简做得比竟争对手少 ...
- Dubbo配置引发的一个问题--- Duplicate spring bean id
1.原因 因项目业务需要,要调用RPC框架,项目原本已经依赖了很多RPC接口需要启动时加载,所以准备做成启动时不预加载. 就是在配置的时候加上check=false. 官方文档解释的作用,就是Dubb ...
- iframe 背景透明设置--兼容IE
iframe标签添加: allowTransparency="true"属性. 子文件body背景设置透明: background-color: transparent;.
- 如何找某个样式属于哪个Element
如果找不到样式所在的Element,那么可以参考排除法,逐个删除覆盖在同一位置的元素,如果该样式消失,那么可以判断为这个样式.
- js 写21点
======================================= var count = 0; function cc(card) {// Only change code below ...