Skip to content

Instantly share code, notes, and snippets.

@KristianLyng
Created March 5, 2011 11:44
Show Gist options
  • Save KristianLyng/856306 to your computer and use it in GitHub Desktop.
Save KristianLyng/856306 to your computer and use it in GitHub Desktop.
kristian@luke:~$ cat /usr/lib/nagios/plugins/check_mount.sh
#!/bin/bash
# CHEF
gawk '
$3 ~ "(ext[0-9]|btrfs)" {
if ($4 !~ "^rw") {
ret=2
ret_status+= " $1 ($2) not mounted RW"
}
}
END {
if (ret == 0) {
ret_status = "OK"
} else {
ret_status = "CRITICAL - " ret_status;
}
print ret_status;
exit(ret)
}' /proc/mounts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment