check_smb.sh
changeset 1 24c279c15743
parent 0 6b1d52c756d5
--- a/check_smb.sh	Tue Jun 07 12:55:47 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#!/bin/sh
-
-REVISION=0.1
-PROGNAME=$(/usr/bin/basename $0)
-
-STATE_OK=0
-STATE_WARNING=1
-STATE_CRITICAL=2
-STATE_UNKNOWN=3
-STATE_DEPENDENT=4
-
-print_revision() {
-    echo "$1 v$2 (nagios-plugins 1.4.15)"
-    echo "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
-}
-
-support() {
-    echo "Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
-}
-
-usage () {
-    echo "\
-Nagios plugin to check if (anonymous) access to SMB on host works.
-
-Usage:
-  $PROGNAME -H <host>
-  $PROGNAME --help
-  $PROGNAME --version
-"
-}
-
-help () {
-    print_revision $PROGNAME $REVISION
-    echo; usage; echo; support
-}
-
-if [ $# -lt 1 ] || [ $# -gt 2 ]; then
-    usage
-    exit $STATE_UNKNOWN
-fi
-
-while test -n "$1"; do
-    case "$1" in
-        --help | -h)
-            help
-            exit $STATE_OK;;
-        --version | -V)
-            print_revision $PROGNAME $REVISION
-            exit $STATE_OK;;
-        -H)
-            shift
-            host=$1;;
-        *)
-            usage; exit $STATE_UNKNOWN;;
-    esac
-    shift
-done
-
-stdout=$(/usr/bin/smbclient -U guest -N -L "$host" 2>&1)
-
-if [ $? -eq 0 ]; then
-    header=$(echo "$stdout" | grep Server= | head -n 1)
-    echo "OK $header"
-    exit $STATE_OK
-else
-    err=$(echo "$stdout" | head -n 1)
-    echo "CRITICAL SMB anon access: $err"
-    exit $STATE_CRITICAL
-fi