checking space availabe on all /proc/mounts points (using Nagios check_disk)

check_disk -w 15% -c 10% $(for x in $(cat /proc/mounts |awk '{print $2}')\; do echo -n " -p $x "\; done)
Sample Output
root@nagios plugins]# pwd

/usr/lib/nagios/plugins

[root@nagios plugins]# ./check_nrpe -H monitored-server -c check_disks_proc_mounts

DISK OK - free space: / 5811 MB (59%); /boot 35 MB (57%); /opt 3401 MB (34%); /dev/shm 1948 MB (100%); /tmp 6731 MB (94%); /var 4222 MB (84%);| /=4033MB;8367;8859;0;9844 /boot=26MB;51;54;0;60 /opt=6676MB;8564;9068;0;10076 /dev/shm=0MB;1655;1753;0;1948 /tmp=395MB;6057;6413;0;7126 /var=820MB;4284;4536;0;5041

4
By: scubacuda
2009-02-19 22:54:06

These Might Interest You

What Others Think

We've accomplished the same thing with less operations - all in a single awk statement. check_disk -w 15% -c 10% $(awk 'BEGIN {x = ""} { x = x " -p " $2 } END {print x}' /proc/mounts)
miketheman · 466 weeks and 4 days ago
hm, which OS is this supposed to work? RH does the trick, however on an old SLES 9.3 it doesn't...
jjlinux · 299 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: