Re: Required improvements in check_disk

Holger Weiß <[email protected]>
Newsgroups gmane.network.nagios.plugins.devel
Organization Freie Universität Berlin
Message-ID <[email protected]>
* Mithun Gaikwad <[email protected]> [2012-04-17 09:52]:
> Is it possible to have check the disk is Read-Only or Red-Write.

check_disk is really just about the fill level.  I'd use a separate
plugin for testing other aspects of the file system.  The following
script should do the trick:

# -----------------------------------------------------------------
#!/bin/sh

if [ $# != 1 ]
then
	echo "UNKNOWN: Usage: $0 <directory>"
	exit 3
fi

directory=$1
tmpfile="$directory/.${0##*/}.XXXXXX"
output=`mktemp "$tmpfile" 2>&1`
status=$?

trap 'rm -f "$tmpfile"' EXIT

if [ $status -eq 0 ]
then
	echo "OK: $directory is writable"
	exit 0
else
	echo "CRITICAL: Cannot write to $directory: ${output##*: }"
	exit 2
fi
# -----------------------------------------------------------------

Holger

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________________
Nagios Plugin Development Mailing List Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.