Fledge
An open source edge computing platform for industrial users
disk_monitor.h
1 #ifndef _DISK_SPACE_MONITOR_H
2 #define _DISK_SPACE_MONITOR_H
3 /*
4  * Fledge storage service.
5  *
6  * Copyright (c) 2024 Dianomic Systems
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch
11  */
12 #include <logger.h>
13 
14 #define CHECK_THRESHOLD 300 // check every 5 minutes
15 
16 #define FAILED_DISK_MONITOR_REPORT_INTERVAL 600 // Interval between loggign failure to stat the filesystem (10 minutes)
17 
23  public:
24  DiskSpaceMonitor(const std::string& db1, const std::string& db2);
25  void periodic(int interval);
26  private:
27  std::string m_dbPath1;
28  std::string m_dbPath2;
29  bool m_started;
30  bool m_sameDevice;
31  unsigned int m_lastCheck;
32  Logger *m_logger;
33  double m_lastPerc1;
34  double m_lastPerc2;
35  double m_lastPrediction1;
36  double m_lastPrediction2;
37  int m_reported;
38 };
39 #endif
Fledge Logger class used to log to syslog.
Definition: logger.h:26
void periodic(int interval)
Called periodically to monitor the disk usage.
Definition: disk_monitor.cpp:48
A class to monitor the free disk space used to store the various storage databases.
Definition: disk_monitor.h:22
DiskSpaceMonitor(const std::string &db1, const std::string &db2)
Construct a disk space monitor class.
Definition: disk_monitor.cpp:36