From 022eb229ee2822e406c0b68facdc1eda96566f5d Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Sun, 31 Dec 2023 21:26:46 +0300 Subject: [PATCH] Add some prometheus code --- CMakeLists.txt | 2 +- main.cpp | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ffc8ec..508e39d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.28) +cmake_minimum_required(VERSION 3.27) project(aliencat_exporter) set(CMAKE_CXX_STANDARD 20) diff --git a/main.cpp b/main.cpp index bc8f460..63fb10e 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,27 @@ #include +#include +#include + +#include +#include +#include int main() { - std::cout << "Hello, World!" << std::endl; + prometheus::Exposer exposer{"127.0.0.1:9000"}; + prometheus::Registry registry; + + auto& gouge = prometheus::BuildGauge() + .Name("aliencat_dnsmasq_leases") + .Register(registry); + + auto& counter = prometheus::BuildCounter() + .Name("aliencat_dnsmasq_leases") + .Register(registry); + + for (;;) { + std::this_thread::sleep_for(std::chrono::seconds(1)); + gouge.Add({"mac", ""}).Set(0); + } + return 0; }