项目作者: ruduran

项目描述 :
Salt beacon to monitor the disk usage (like du command) of directories
高级语言: Python
项目地址: git://github.com/ruduran/salt-du-beacon.git
创建时间: 2017-02-20T19:49:59Z
项目社区:https://github.com/ruduran/salt-du-beacon

开源协议:

下载


salt-du-beacon

Salt beacon to monitor the space used by all the files inside a directory.

Requirements

python-sh needs to be installed.

Configuration

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.

  1. beacons:
  2. du:
  3. /tmp: 524288
  4. /media: 20971520
  5. interval: 10

Sample events

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:

  1. salt/beacon/minion/du/ {
  2. "_stamp": "2017-02-20T20:59:55.249440",
  3. "id": "minion",
  4. "path": "/tmp",
  5. "threshold": 524288,
  6. "used": 587679
  7. }
  8. salt/beacon/minion1/du/ {
  9. "_stamp": "2017-02-20T20:59:55.252359",
  10. "id": "minion",
  11. "path": "/media",
  12. "threshold": 20971520,
  13. "used": 37516389
  14. }

TODO

  • Docstrings in the code
  • Allow units in the configuration (e.g. 512M, 20G)