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
- 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
=>
prometheus-net_rev1.json
asp-net-metrics_rev1.json