Retrait de Prometheus
This commit is contained in:
51
main.cpp
51
main.cpp
@@ -6,11 +6,6 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include "AutomForArduino.cpp"
|
#include "AutomForArduino.cpp"
|
||||||
|
|
||||||
#include <prometheus/counter.h>
|
|
||||||
#include <prometheus/gauge.h>
|
|
||||||
#include <prometheus/registry.h>
|
|
||||||
#include <prometheus/exposer.h>
|
|
||||||
|
|
||||||
// Constantes de fonctionnement
|
// Constantes de fonctionnement
|
||||||
#define LEVEL_MIN 2
|
#define LEVEL_MIN 2
|
||||||
#define FLOW_PER_PUMP 150
|
#define FLOW_PER_PUMP 150
|
||||||
@@ -23,8 +18,6 @@ unsigned short pompe1, pompe2, pompe3, pompe4; // bouton des pompes 0 (arrêt) /
|
|||||||
unsigned short pompe1_old, pompe2_old, pompe3_old, pompe4_old;
|
unsigned short pompe1_old, pompe2_old, pompe3_old, pompe4_old;
|
||||||
unsigned short sensor_max, sensor_high, sensor_low, sensor_min;
|
unsigned short sensor_max, sensor_high, sensor_low, sensor_min;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float TankInitalValue = 7;
|
float TankInitalValue = 7;
|
||||||
|
|
||||||
TemporisationRetardMontee tempo1(500);
|
TemporisationRetardMontee tempo1(500);
|
||||||
@@ -34,11 +27,7 @@ TemporisationRetardMontee tempo4(2000);
|
|||||||
|
|
||||||
// Prometheus
|
// Prometheus
|
||||||
// ************************************************************
|
// ************************************************************
|
||||||
using namespace prometheus;
|
|
||||||
|
|
||||||
std::shared_ptr<Registry> registry;
|
|
||||||
Gauge* debit_entree = nullptr;
|
|
||||||
Gauge* debit_sortie = nullptr;
|
|
||||||
// ************************************************************
|
// ************************************************************
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@@ -781,49 +770,11 @@ void AffichageGraphe(int y, int x, double value)
|
|||||||
*/
|
*/
|
||||||
void InitPrometheus()
|
void InitPrometheus()
|
||||||
{
|
{
|
||||||
static Exposer exposer{"0.0.0.0:8099"};
|
|
||||||
|
|
||||||
// Le registre central
|
|
||||||
registry = std::make_shared<Registry>();
|
|
||||||
|
|
||||||
exposer.RegisterCollectable(registry);
|
|
||||||
|
|
||||||
// Exemple : gauge (comme votre debit)
|
|
||||||
auto& gauge_family = BuildGauge()
|
|
||||||
.Name("geii_debit")
|
|
||||||
.Help("Débit en l/s")
|
|
||||||
.Register(*registry);
|
|
||||||
|
|
||||||
debit_entree = &gauge_family.Add({{"numero", "entree"}});
|
|
||||||
debit_sortie = &gauge_family.Add({{"numero", "sortie"}});
|
|
||||||
|
|
||||||
/*
|
|
||||||
int result = pcr_init(0,"geii_");
|
|
||||||
|
|
||||||
std::array<const char*, 1> labels = { "numero" };
|
|
||||||
pm_pompe = prom_counter_new("pompe_on", "Mise en marche de la pompe"
|
|
||||||
, labels.size(), labels.data());
|
|
||||||
pcr_register_metric(pm_pompe);
|
|
||||||
|
|
||||||
pm_debit = prom_gauge_new("debit", "Débit en l/s"
|
|
||||||
, labels.size(), labels.data());
|
|
||||||
pcr_register_metric(pm_debit);
|
|
||||||
|
|
||||||
promhttp_set_active_collector_registry(NULL);
|
|
||||||
|
|
||||||
// Serveur web
|
|
||||||
server = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY
|
|
||||||
, 8099, NULL, NULL);
|
|
||||||
if (server == NULL)
|
|
||||||
{
|
|
||||||
printf("Impossible de démarrer le serveur HTTP\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessPrometheus()
|
void ProcessPrometheus()
|
||||||
{
|
{
|
||||||
debit_entree->Set(_digital[IN_FLOW_OUT].dvalue);
|
|
||||||
debit_sortie->Set(_digital[IN_FLOW_IN].dvalue);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user