How to dtermine disk space in Linux

Kevin Keane subscription at kkeane.com
Thu Jan 29 14:34:23 CET 2009


I'm not sure what 3 plugins you are trying. I am using a bash script 
with a little df and awk thrown in:

The whole script does a lot more, but the key part is this:

The critical and warn percentages are in $CDISKUSAGE and $WDISKUSAGE, 
respectively.

Note that this will check all file systems, including CDROM, removable 
disks, etc. So you may need to modify the call to df a bit to make it 
work for you. Hint: try the -t or -x arguments to check only the file 
systems you are interested in.

function checkdiskspace()
{
   local retval
   df -Ph | awk " { if(int(\$5)>=$CDISKUSAGE) { print \"CRIT\", 
\$0,\"<br>\" } else if (int(\$5)>=$WDISKUSAGE) {print \"WARN\", 
\$0,\"<br>\" } }" > /tmp/$$
   cat /tmp/$$
   retval=0
   grep "^CRIT " /tmp/$$ >/dev/null
   if [ $? -eq 0 ]
   then
      retval=2
   else
      grep "^WARN " /tmp/$$ >/dev/null
      if [ $? -eq 0 ]
      then
          retval=1
      else
          echo "All disks OK"
      fi
   fi
   rm -f /tmp/$$
   return $retval
}


Edwin Zoeller wrote:
> I hope someone can help and explain this to me. I am trying to use one
> of three plugins for Nagios to check disk space on a Linux file system.
> When I plug in values that I thinks would work, I don't understand what
> its telling me. Can someone shed some lite. I am used to the plugins on
> Solaris which you can set up a percentage, much easier.
>
> Thanks

-- 
Kevin Keane
Owner
The NetTech
Find the Uncommon: Expert Solutions for a Network You Never Have to Think About

Office: 866-642-7116
http://www.4nettech.com

This e-mail and attachments, if any, may contain confidential and/or proprietary information. Please be advised that the unauthorized use or disclosure of the information is strictly prohibited. The information herein is intended only for use by the intended recipient(s) named above. If you have received this transmission in error, please notify the sender immediately and permanently delete the e-mail and any copies, printouts or attachments thereof.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list