diff options
-rw-r--r-- | gentoobrowse-api/service/maintenanceBugs.cpp | 4 | ||||
-rw-r--r-- | gentoobrowse-api/service/maintenanceGitOperations.cpp | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gentoobrowse-api/service/maintenanceBugs.cpp b/gentoobrowse-api/service/maintenanceBugs.cpp index b40c130..d7832fd 100644 --- a/gentoobrowse-api/service/maintenanceBugs.cpp +++ b/gentoobrowse-api/service/maintenanceBugs.cpp @@ -93,6 +93,7 @@ namespace Gentoo::Service { AdHocFormatter(UpdatingBugs, "Refreshing bug list from %?"); AdHocFormatter(UpdatingBugUrl, " ... %?"); AdHocFormatter(UpdatingBugsResult, "Refreshed bug list: %? added, %? updated, %? removed"); + AdHocFormatter(UpdatingBugsResultPerf, "|added=%? updated=%? removed=%?"); constexpr const std::string_view NagiosServiceName("GB API Bug Updates"); void Maintenance::refreshBugs(const Ice::Current & c) @@ -125,7 +126,8 @@ namespace Gentoo::Service { log->messagectf<UpdatingBugsResult>( IceTray::Logging::LogLevel::INFO, result.inserts, result.updates, result.deletes); AdHoc::submitNagiosPassiveServiceCheck(NagiosServiceName, AdHoc::NagiosStatusCode::OK, - UpdatingBugsResult::get(result.inserts, result.updates, result.deletes)); + UpdatingBugsResult::get(result.inserts, result.updates, result.deletes) + + UpdatingBugsResultPerf::get(result.inserts, result.updates, result.deletes)); } catch (const std::exception & ex) { AdHoc::submitNagiosPassiveServiceCheck(NagiosServiceName, AdHoc::NagiosStatusCode::Warning, ex.what()); diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp index a91116b..a5a9ed0 100644 --- a/gentoobrowse-api/service/maintenanceGitOperations.cpp +++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp @@ -185,7 +185,7 @@ namespace Gentoo::Service { return changes; } - constexpr const std::string_view NagiosServiceName("GB API Package Updates"); + AdHocFormatter(NagiosServiceUpdate, "GB API Package Updates|changes=%?"); void Maintenance::refreshPackageTree(const Ice::Current & c) { @@ -194,17 +194,20 @@ namespace Gentoo::Service { auto repoRoot = std::filesystem::path(properties->getPropertyWithDefault("GentooBrowseAPI.RepoRoot", "/")); auto dbc = db->get(); DB::TransactionScope tx(*dbc.get()); + size_t total {}; for (const auto & repo : fetch<Gentoo::Repositories>(dbc.get(), sql::maintenance::reposToGitRefresh)) { auto changes = refreshRepository(dbc.get(), properties, repo); + total += changes.size(); this->applyFileChanges(dbc.get(), repoRoot, repo, changes); } time_t now = time(nullptr); sd_notifyf(0, "STATUS=Last update %s", ctime(&now)); AdHoc::submitNagiosPassiveServiceCheck( - NagiosServiceName, AdHoc::NagiosStatusCode::OK, "Package tree(s) updated"); + NagiosServiceUpdate::get(total), AdHoc::NagiosStatusCode::OK, "Package tree(s) updated"); } catch (const std::exception & ex) { - AdHoc::submitNagiosPassiveServiceCheck(NagiosServiceName, AdHoc::NagiosStatusCode::Warning, ex.what()); + AdHoc::submitNagiosPassiveServiceCheck( + NagiosServiceUpdate::get(0), AdHoc::NagiosStatusCode::Warning, ex.what()); throw; } } |