You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __ARGUS_SERVER_LIFE_MONOTORING__
  2. #define __ARGUS_SERVER_LIFE_MONOTORING__
  3. #include "../../components/base/basicValidatable.h"
  4. #include "../../components/base/basicLogCollection.h"
  5. #include "../../components/base/basicThread.h"
  6. #include "../common/serverMySQL_dataBinder.h"
  7. #define LM_SKEEP_MONITORING_SECONDS 180 // 3 Minutes Seep time from beginning
  8. typedef struct S_HEALTH_MONITORING_ZONE{
  9. bool module_monitored[4];
  10. uint64_t module_id[4];
  11. uint8_t module_status[4];
  12. uint64_t platform_id;
  13. uint8_t lvl;
  14. uint64_t lvl_id;
  15. bool validated;
  16. }HEALTH_MONITORING_ZONE;
  17. typedef std::vector<HEALTH_MONITORING_ZONE *> V_HEALTH_MONITORING_ZONES;
  18. class servaLifeMonitoring : public basicValidatable, basicThread {
  19. private:
  20. static servaLifeMonitoring * _Instance;
  21. basicLogCollection * m_pLog;
  22. servaMySQLDBC * m_pDBC;
  23. basicMutex m_mMonitoringZonesProtector;
  24. V_HEALTH_MONITORING_ZONES m_vMonitoringZones;
  25. uint32_t m_nStartupTS; // to skip initial startup time
  26. bool validateZone( HEALTH_MONITORING_ZONE *ptr );
  27. uint8_t validateModule( uint64_t module_id );
  28. servaLifeMonitoring();
  29. protected:
  30. virtual void m_fThreadProc( void );
  31. public:
  32. static servaLifeMonitoring * getInstance();
  33. ~servaLifeMonitoring();
  34. virtual bool validate();
  35. };
  36. #endif