![]() |
Fledge
An open source edge computing platform for industrial users
|
A class to monitor the free disk space used to store the various storage databases. More...
#include <disk_monitor.h>
Public Member Functions | |
DiskSpaceMonitor (const std::string &db1, const std::string &db2) | |
Construct a disk space monitor class. More... | |
void | periodic (int interval) |
Called periodically to monitor the disk usage. More... | |
A class to monitor the free disk space used to store the various storage databases.
DiskSpaceMonitor::DiskSpaceMonitor | ( | const std::string & | db1, |
const std::string & | db2 | ||
) |
Construct a disk space monitor class.
It monitors the free space on two path, since the storage service may use different locations for reading and configuration storage. If they are both the same file system then the monitor is only done once.
If the free space falls below 5% a fatal error is written to the error log If it falls below 10% a warning is written advising that disk space should be released It attempts to predict when storage will become exhausted. If it is less then 14 days it will report this to the error log once a day. If it is less than 72 hours it will report this once per hour.
All reporting is to the system log
NB In an ideal world we would make the thresholds and reporting interval configurable, however we are running within the limited environment of a storage plugin and do not have access to the manaagement client or configuration subsystem.
void DiskSpaceMonitor::periodic | ( | int | interval | ) |
Called periodically to monitor the disk usage.
interval | The number of seconds between calls |