2021-04-09 08:53:05 -07:00
|
|
|
using k8s;
|
|
|
|
|
using Prometheus;
|
2022-09-16 01:21:21 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Threading;
|
2021-04-09 08:53:05 -07:00
|
|
|
|
|
|
|
|
namespace prom
|
|
|
|
|
{
|
|
|
|
|
internal class Prometheus
|
|
|
|
|
{
|
|
|
|
|
private static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
var config = KubernetesClientConfiguration.BuildDefaultConfig();
|
|
|
|
|
var handler = new PrometheusHandler();
|
2023-04-04 22:35:39 +02:00
|
|
|
IKubernetes client = new Kubernetes(config, handler);
|
2021-04-09 08:53:05 -07:00
|
|
|
|
|
|
|
|
var server = new MetricServer(hostname: "localhost", port: 1234);
|
|
|
|
|
server.Start();
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Making requests!");
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
2022-05-07 13:05:17 -07:00
|
|
|
client.CoreV1.ListNamespacedPod("default");
|
|
|
|
|
client.CoreV1.ListNode();
|
|
|
|
|
client.AppsV1.ListNamespacedDeployment("default");
|
2021-04-09 08:53:05 -07:00
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|