dotnet core 监控

 

prometheus-net.DotNetRuntime 获取 CLR 指标原理解析

 

.Net Core服务监控报警指标上报Prometheus+Grafana

https://www.cnblogs.com/linhuiy/p/13157250.html

Nuget导入Prometheus.AspNetCore包
prometheus-net.DotNetRuntime

 

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{

    app.UseMetricServer();
    
}

  

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseMetricServer();
    
    app.UseRouting();
    
    app.UseHttpMetrics();

    app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}

  

http://localhost:5000/metrics

 
配置prometheus.yml
http://localhost:9090/targets
  - job_name: 'TEST API'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    scheme: https
    static_configs:
    - targets: ['localhost:44398']
    tls_config:
      insecure_skip_verify: true

配置grafana

=>
 
 
 

posted on 2021-08-07 22:16  白马酒凉  阅读(156)  评论(0编辑  收藏  举报

导航