Merge remote-tracking branch 'origin/topic/timw/zeekctl-check-telemetry'

* origin/topic/timw/zeekctl-check-telemetry:
  Check for 'zeekctl check' before trying to start up prometheus
This commit is contained in:
Tim Wojtulewicz 2024-06-06 18:06:42 -07:00
commit 16d39b9978
3 changed files with 15 additions and 9 deletions

View file

@ -1,3 +1,7 @@
7.0.0-dev.366 | 2024-06-06 18:06:42 -0700
* Check for 'zeekctl check' before trying to start up prometheus (Tim Wojtulewicz, Corelight)
7.0.0-dev.362 | 2024-06-04 14:16:54 -0700 7.0.0-dev.362 | 2024-06-04 14:16:54 -0700
* Switch to zeek fork of prometheus-cpp (Tim Wojtulewicz, Corelight) * Switch to zeek fork of prometheus-cpp (Tim Wojtulewicz, Corelight)

View file

@ -1 +1 @@
7.0.0-dev.362 7.0.0-dev.366

View file

@ -70,16 +70,18 @@ void Manager::InitPostScript() {
} }
} }
try { if ( ! getenv("ZEEKCTL_CHECK_CONFIG") ) {
prometheus_exposer = std::make_unique<prometheus::Exposer>(prometheus_url, 2, callbacks); try {
prometheus_exposer = std::make_unique<prometheus::Exposer>(prometheus_url, 2, callbacks);
// CivetWeb stores a copy of the callbacks, so we're safe to delete the pointer here // CivetWeb stores a copy of the callbacks, so we're safe to delete the pointer here
delete callbacks; delete callbacks;
} catch ( const CivetException& exc ) { } catch ( const CivetException& exc ) {
reporter->FatalError("Failed to setup Prometheus endpoint: %s\n", exc.what()); reporter->FatalError("Failed to setup Prometheus endpoint: %s\n", exc.what());
}
prometheus_exposer->RegisterCollectable(prometheus_registry);
} }
prometheus_exposer->RegisterCollectable(prometheus_registry);
} }
#ifdef HAVE_PROCESS_STAT_METRICS #ifdef HAVE_PROCESS_STAT_METRICS