From: Alberto Leiva Popper Date: Thu, 11 Sep 2025 23:45:57 +0000 (-0600) Subject: Add gauge to track RTR readyness X-Git-Tag: 1.6.7~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67f5bde778a44e0e9f01780c93d2841587282d2c;p=thirdparty%2FFORT-validator.git Add gauge to track RTR readyness Starts as 0, becomes 1 when the VRP database has been populated. Intended to replace the awkward log msg at least one user tracks: > First validation cycle successfully ended, > now you can connect your router(s) For #133. --- diff --git a/src/main.c b/src/main.c index 676cdba0..84cc2d58 100644 --- a/src/main.c +++ b/src/main.c @@ -49,11 +49,9 @@ fort_server(void) rtr_notify(); - /* - * See issue #133. - * TODO (#50) Remove this message once the stats server is implemented. - */ + /* TODO (#133) Stats ready; remove this message in a couple versions. */ pr_op_warn("First validation cycle successfully ended, now you can connect your router(s)"); + stats_gauge_set(stat_rtr_ready, 1); do { pr_op_info("Main loop: Sleeping."); diff --git a/src/stats.c b/src/stats.c index 6f2d391d..96dca04e 100644 --- a/src/stats.c +++ b/src/stats.c @@ -19,6 +19,7 @@ struct stats_gauge { static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static struct stats_gauge *gauges; +struct stats_gauge *stat_rtr_ready; struct stats_gauge *stat_rtr_connections; /* Steals ownership of @name */ @@ -65,6 +66,7 @@ add_gauge(char *name, size_t namelen, unsigned int value) int stats_setup(void) { + stat_rtr_ready = ADD_GAUGE("fort_rtr_ready"); stat_rtr_connections = ADD_GAUGE("fort_rtr_current_connections"); return 0; } diff --git a/src/stats.h b/src/stats.h index 8d190301..74583b41 100644 --- a/src/stats.h +++ b/src/stats.h @@ -2,6 +2,7 @@ #define SRC_STATS_H_ struct stats_gauge; +extern struct stats_gauge *stat_rtr_ready; extern struct stats_gauge *stat_rtr_connections; int stats_setup(void);