Disk monitoring state
Monitor the state of disk resources.
The disk.status
function can be used to report that the used space of a
filesystem is within the specified limits.
used_space:
disk.status:
- name: /dev/xda1
- maximum: 79%
- minimum: 11%
It can be used with an onfail
requisite, for example, to take additional
action in response to or in preparation for other states.
storage_threshold:
disk.status:
- name: /dev/xda1
- maximum: 97%
clear_cache:
cmd.run:
- name: rm -r /var/cache/app
- onfail:
- disk: storage_threshold
To use kilobytes (KB) for minimum
and maximum
rather than percents,
specify the absolute
flag:
used_space:
disk.status:
- name: /dev/xda1
- minimum: 1024 KB
- maximum: 1048576 KB
- absolute: True
salt.states.disk.
status
(name, maximum=None, minimum=None, absolute=False, free=False)¶Return the current disk usage stats for the named mount point
Disk mount or directory for which to check used space
The maximum disk utilization
The minimum disk utilization
By default, the utilization is measured in percentage. Set the absolute flag to use kilobytes.
New in version 2016.11.0.
By default, minimum & maximum refer to the amount of used space. Set to True to evaluate the free space instead.