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.

41 lines
1.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. }HEALTH_MONITORING_ZONE;
  16. typedef std::vector<HEALTH_MONITORING_ZONE *> V_HEALTH_MONITORING_ZONES;
  17. class servaLifeMonitoring : public basicValidatable, basicThread {
  18. private:
  19. static servaLifeMonitoring * _Instance;
  20. basicLogCollection * m_pLog;
  21. servaMySQLDBC * m_pDBC;
  22. basicMutex m_mMonitoringZonesProtector;
  23. V_HEALTH_MONITORING_ZONES m_vMonitoringZones;
  24. uint32_t m_nStartupTS; // to skip initial startup time
  25. bool validateZone( HEALTH_MONITORING_ZONE *ptr );
  26. uint8_t validateModule( uint64_t module_id );
  27. servaLifeMonitoring();
  28. protected:
  29. virtual void m_fThreadProc( void );
  30. public:
  31. static servaLifeMonitoring * getInstance();
  32. ~servaLifeMonitoring();
  33. virtual bool validate();
  34. };
  35. #endif