1

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
JellicleCat
  • 284
  • 1
  • 3
  • 15

1 Answers1

3

Monit requires the actual mountpoint to be specified.

If you're trying to get the root filesystem, you should use /.

check device root with path /
    if SPACE usage > 85% then alert
ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • Thanks! +1. But I'm running the same version of Monit (2.26) on another server, and I specify the device `/dev/sda` instead of the mount point `/` on it, and it tests successfully. And the doc also says that the device is acceptable. Do you have any idea why the device isn't working on the server at hand? – JellicleCat Jan 05 '21 at 16:03
  • Use the path specification of `/`. Why wouldn't you use that? – ewwhite Jan 05 '21 at 16:13
  • Thanks, @ewwite. I am using it. I just asked hoping to learn the explanation for why specifying the device doesn't work when the mount shows a device of `/dev/root`. – JellicleCat Jan 05 '21 at 16:28