public async void PrometheusNicGuid() { var collector = new NicGuidSensor(); var registry = PrometheusCollection.SetupDefault(collector); var mserver = new MetricServer("localhost", 21882, registry: registry); using var server = new PrometheusServer(mserver, collector); using var client = new HttpClient(); server.Start(); var resp = await client.GetAsync("http://localhost:21882/metrics"); Assert.True(resp.IsSuccessStatusCode); var content = await resp.Content.ReadAsStringAsync(); Assert.Contains("Bluetooth Network Connection 2", content); }
public async void PrometheusTestServer() { var collector = new TestSensorCreator(); var registry = PrometheusCollection.SetupDefault(collector); var mserver = new MetricServer("localhost", 21881, registry: registry); using var server = new PrometheusServer(mserver, collector); using var client = new HttpClient(); server.Start(); var resp = await client.GetAsync("http://localhost:21881/metrics"); Assert.True(resp.IsSuccessStatusCode); var content = await resp.Content.ReadAsStringAsync(); Assert.Contains("# HELP ohm_cpu_celsius Metric reported by open hardware sensor", content); }
public async void PrometheusTestServer() { var collector = new TestSensorCreator(); var prometheusCollection = new PrometheusCollection(collector, "my-pc"); var mserver = new MetricServer("localhost", 21881); var server = new PrometheusServer(mserver, collector, prometheusCollection); try { server.Start(); var client = new HttpClient(); var resp = await client.GetAsync("http://localhost:21881/metrics"); Assert.True(resp.IsSuccessStatusCode); var content = await resp.Content.ReadAsStringAsync(); Assert.Contains("# HELP intelcpu_0_temperature_0 Metric reported by open hardware sensor", content); } finally { server.Stop(); } }
public async void PrometheusNicGuid() { var collector = new NicGuidSensor(); var prometheusCollection = new PrometheusCollection(collector, "my-pc", Metrics.DefaultRegistry); var mserver = new MetricServer("localhost", 21881); var server = new PrometheusServer(mserver, collector); try { server.Start(); var client = new HttpClient(); var resp = await client.GetAsync("http://localhost:21881/metrics"); Assert.True(resp.IsSuccessStatusCode); var content = await resp.Content.ReadAsStringAsync(); Assert.Contains("Bluetooth Network Connection 2", content); } finally { server.Stop(); } }