--- /dev/null
+# Register the routine with the plugin registry
+$PLUGINS{'smb'} = \&check_smb;
+
+# This will do a very simple SMB check by using the smbclient command
+# to probe the SMB service at the remote host. It checks to make sure
+# it can at least query SMB services anonymously.
+
+# $Id: check_smb,v 1.1 2005/09/13 15:41:34 willamowius Exp $
+
+use Spong::SafeExec qw(safe_exec);
+
+sub check_smb {
+ my( $host ) = @_;
+ my( $color, $summary, $message, $smbok ) = ( "green", "", "", 0 );
+ my( $msg1 );
+
+ $msg1 = safe_exec("/usr/bin/smbclient -L '\\$host' -N 2>&1",30);
+ if( $msg1 =~ /Anonymous login successful/ ) { $smbok = 1; }
+
+ $message = "$msg1\n";
+ if( $smbok ) {
+ $color = "green";
+ $summary = "smb ok";
+ } else {
+ $color = "red";
+ $summary = "smb down";
+ }
+
+ &debug( "smb - $host - $color, $summary" );
+ return( $color, $summary, $message );
+}
+
+1;
+