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.

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