I'm finding monit unable to monitor a filesystem effectively. I've added a file /etc/monit.d/disk.cnf
with the following:
check device disk1 with path /dev/root
if space usage > 85% then exec "/bin/custom-alert"
...And when I monit reload
, the monit log tells me:
[PST Jan 4 14:48:39] error : 'disk1' filesystem doesn't exist
[PST Jan 4 14:48:39] info : 'disk1' trying to restart
Okay, so I cat /proc/cmdline
and learn that root=/dev/sda
, and then I replace /dev/root
with /dev/sda
in my disk.cnf
file. Then the monit log tells me:
[PST Jan 4 14:46:35] error : Device /dev/sda not found in /etc/mtab
[PST Jan 4 14:46:35] error : 'disk1' unable to read filesystem /dev/sda state
Indeed, /etc/mtab
references /dev/root
instead of /dev/sda
.
Why can't monit access the filesystem when I specify /dev/root
or /dev/sda
on this machine?
More info: df -h
outputs the following:
Filesystem Size Used Avail Use% Mounted on
/dev/root 173G 146G 26G 85% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 3.2G 29G 11% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
tmpfs 6.3G 0 6.3G 0% /run/user/1000
Monit requires the actual mountpoint to be specified.
If you're trying to get the root filesystem, you should use
/
.