I am trying to monitor my aspnet core webapp in k8s with Grafana-Influxdb through App Metrics Template.
I have followed all the steps posted in this article and the App metrics documentation. However, I cannot see any data coming from Influx-db.
Some of the things that I have already checked:
[httpd] xx.xxxx.xx.xx - - [07/Mar/2019:01:58:14 +0000] "GET /ping HTTP/1.1" 204 0 "-" "kube-probe/1.12" 77f046bd-407c-11e9-b1f0-a68c07c04186 54
The code to connect with Influxdb:
var metrics = new MetricsBuilder()
.Report.ToInfluxDb(options => {
options.InfluxDb.BaseUri = new Uri("http://influxdb-influxdb.monitoring:8086");
options.InfluxDb.Database = "appmetrics";
options.InfluxDb.Consistenency = "consistency";
options.InfluxDb.RetentionPolicy = "rp";
options.InfluxDb.CreateDataBaseIfNotExists = true;
options.HttpPolicy.BackoffPeriod = TimeSpan.FromSeconds(30);
options.HttpPolicy.FailuresBeforeBackoff = 5;
options.HttpPolicy.Timeout = TimeSpan.FromSeconds(10);
options.MetricsOutputFormatter = new MetricsInfluxDbLineProtocolOutputFormatter();
options.FlushInterval = TimeSpan.FromSeconds(20);
})
.Build();
services.AddMemoryCache();
services.AddMetrics(metrics);
The solution was provided by the Javier Hertfelder in the comments:
What I did to make to make it work was to follow the demo
AspNetCore2.Api.Reservoirs
in this repository github.com/AppMetrics/Samples.V2 There are plenty of options to configure the Metrics and all the previous did not work for me