mon_messagebus.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <library/cpp/messagebus/ybus.h>
  3. #include <library/cpp/messagebus/www/www.h>
  4. #include <library/cpp/monlib/service/pages/mon_page.h>
  5. namespace NMonitoring {
  6. template <class TBusSmth>
  7. class TBusSmthMonPage: public NMonitoring::IMonPage {
  8. private:
  9. TBusSmth* Smth;
  10. public:
  11. explicit TBusSmthMonPage(const TString& name, const TString& title, TBusSmth* smth)
  12. : IMonPage("msgbus/" + name, title)
  13. , Smth(smth)
  14. {
  15. }
  16. void Output(NMonitoring::IMonHttpRequest& request) override {
  17. Y_UNUSED(request);
  18. request.Output() << NMonitoring::HTTPOKHTML;
  19. request.Output() << "<h2>" << Title << "</h2>";
  20. request.Output() << "<pre>";
  21. request.Output() << Smth->GetStatus();
  22. request.Output() << "</pre>";
  23. }
  24. };
  25. using TBusQueueMonPage = TBusSmthMonPage<NBus::TBusMessageQueue>;
  26. using TBusModuleMonPage = TBusSmthMonPage<NBus::TBusModule>;
  27. class TBusNgMonPage: public NMonitoring::IMonPage {
  28. public:
  29. TIntrusivePtr<NBus::TBusWww> BusWww;
  30. public:
  31. TBusNgMonPage()
  32. : IMonPage("messagebus", "MessageBus")
  33. , BusWww(new NBus::TBusWww)
  34. {
  35. }
  36. void Output(NMonitoring::IMonHttpRequest& request) override;
  37. };
  38. }