Salt beacon to monitor the disk usage (like du command) of directories
Salt beacon to monitor the space used by all the files inside a directory.
python-sh needs to be installed.
The list of paths along with the threshold (in KiB) is required.
For instance, the following configuration in /etc/salt/minion.d/beacons.conf
generates events when /tmp grows bigger than 512MiB and
when /media takes 20GiB or more.
The checks are performed every 10 seconds.
beacons:
du:
/tmp: 524288
/media: 20971520
interval: 10
Using the following command on the Salt master we can
display the events as they are received:
salt-run state.event pretty=true
Some examples of events generated by this beacon are:
salt/beacon/minion/du/ {
"_stamp": "2017-02-20T20:59:55.249440",
"id": "minion",
"path": "/tmp",
"threshold": 524288,
"used": 587679
}
salt/beacon/minion1/du/ {
"_stamp": "2017-02-20T20:59:55.252359",
"id": "minion",
"path": "/media",
"threshold": 20971520,
"used": 37516389
}