15

I use monit on my server to monitor apache and mysql running.

Now I want to add an alert if the disk gets too full. I added this for testing in /etc/monit/monitrc:

check device rootfs with path /dev/md0
    if space usage > 10% then alert

I have two partitions I want to check: / and /var:

mount
/dev/md0 on / type ext3 (rw)
/dev/md2 on /var type ext3 (rw)

What are useful checks in this configuration apart from diskspace?

1 Answer 1

27

There isn't much to do here. Your current check is syntactically correct, but may not be practical. Why do you care if space utilization is greater than 10%??!?

A typical disk check stanza would look like:

check device var with path /var
    if SPACE usage > 80% then alert

That basically will send an email if the drive is more than 80% full. Monit will also let you know once the data usage falls below that level. Also look at the Monit documentation.

Type monit status at the command line. Here's what Monit sees about your filesytem:

Filesystem 'var'
  status                            Accessible
  monitoring status                 Monitored
  permission                        755
  uid                               0
  gid                               0
  filesystem flags                  0x400
  block size                        4096 B
  blocks total                      1523090 [5949.6 MB]
  blocks free for non superuser     979860 [3827.6 MB] [64.3%]
  blocks free total                 1058477 [4134.7 MB] [69.5%]
  inodes total                      1572864
  inodes free                       1563392 [99.4%]
  data collected                    Sat, 03 Aug 2013 22:07:28
5
  • 10% was only for testing
    – rubo77
    Commented Aug 4, 2013 at 13:15
  • 1
    what about the other examples in the config file? ` # if inode usage > 80% then alert ` Is it important to check inodes extra?
    – rubo77
    Commented Aug 4, 2013 at 13:20
  • Not unless you're planning a lot of files on the filesytem...
    – ewwhite
    Commented Aug 4, 2013 at 13:37
  • 5
    I think check device must be some old syntax, because the manual doesn't mention it anymore. I think check filesystem is the new way to do it.
    – RyanTM
    Commented Jan 27, 2017 at 0:11
  • @RyanTM is right. Check the new syntax here mmonit.com/monit/documentation/monit.html Commented Jan 17, 2023 at 17:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .