Code

Removed suffix of "-rate" and let user decide label via --label
[nagiosplug.git] / contrib / check_wins.pl
index 58a597aa59fe491140ab4fb68bb3091a7ddcf51e..f11f86456fa83cc168aa74ea12970e79868d7fb4 100755 (executable)
@@ -1,8 +1,13 @@
 #!/usr/bin/perl -w
 
-# $Id$
+# $Id: check_wins.pl 940 2004-11-25 04:46:16Z stanleyhopcroft $
 
-# $Log$
+# Revision 1.3  2004/11/25 04:46:16  stanleyhopcroft
+# Non functional tidy ups to check_wins
+#
+# Revision 1.2  2003/08/20 08:31:49  tonvoon
+# Changed netsaint to nagios in use lib
+#
 # Revision 1.1  2003/02/09 14:16:28  sghosh
 # more contribs
 #
@@ -12,14 +17,13 @@ use strict ;
 use Getopt::Long ;
 use vars qw($opt_H $opt_D $opt_W $opt_T $debug @my_dcs);
 
-use lib '/usr/local/netsaint/libexec/' ;
+use lib '/usr/local/nagios/libexec/' ;
 use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
 
 my $PROGNAME = 'check_wins' ;
 
 use constant SAMBA_DEBUG_LVL   => 2 ;
 use constant MY_DCS            => ('dc1','dc2') ;
-# use constant MY_DCS          => qw(ipa01 ipa02 ipa03) ;
 
 my $NMBLOOKUP_PATH             = '/usr/bin/nmblookup' ;
 my $NMBLOOKUP                  = sub { return `$NMBLOOKUP_PATH $_[2] -R -U $_[0] $_[1]` } ;
@@ -64,8 +68,8 @@ my (@addr_dcs_of_domain, @found_dcs, %address2dc) ;
 my (@dc_query) ;
 
 # tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipa01
-# Sending queries to 10.0.100.29
-# 10.0.100.16 ipa01<00>
+# Sending queries to 192.168.1.29
+# 192.168.1.16 ipa01<00>
 
 eval {
   alarm($TIMEOUT) ;
@@ -90,11 +94,17 @@ if ( scalar grep(/name_query failed/, @dc_query) ) {
   exit $ERRORS{"CRITICAL"} ;
 }
 
-# the results of looking up the DCs (by their name) in the WINS 
+=begin comment
+
+the results of looking up the DCs (by their name) in the WINS 
+
+192.168.1.16 ipa01<20>
+192.168.1.1 ipa02<20>
+192.168.1.104 ipa03<20>
+
+=end comment
 
-# 10.0.100.16 ipa01<20>
-# 10.0.100.1 ipa02<20>
-# 10.0.100.104 ipa03<20>
+=cut
 
 @dc_addresses = () ;
 foreach (@dc_query) {
@@ -126,34 +136,23 @@ shift @dcs_of_domain ;
 chomp @dcs_of_domain ;
 @addr_dcs_of_domain = map /^(\S+)/, @dcs_of_domain ;
 
-# tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipaustralia#1c
-# Sending queries to 10.0.100.29
-# 10.0.100.114 ipaustralia<1c>
-# 168.168.102.129 ipaustralia<1c>
-# 192.168.101.221 ipaustralia<1c>
-# 10.0.100.61 ipaustralia<1c>
-# 192.168.108.129 ipaustralia<1c>
-# 192.168.102.128 ipaustralia<1c>
-# 10.0.4.126 ipaustralia<1c>
-# 192.168.106.214 ipaustralia<1c>
-# 10.0.3.165 ipaustralia<1c>
-# 192.168.105.214 ipaustralia<1c>
-# 10.0.6.145 ipaustralia<1c>
-# 192.168.104.128 ipaustralia<1c>
-# 10.0.4.59 ipaustralia<1c>
-# 10.9.99.99 ipaustralia<1c>
-# 10.99.99.99 ipaustralia<1c>
-# 10.9.99.254 ipaustralia<1c>
-# 10.0.3.15 ipaustralia<1c>
-# 192.168.102.129 ipaustralia<1c>
-# 192.168.103.129 ipaustralia<1c>
-# 192.168.105.129 ipaustralia<1c>
-# 192.168.106.129 ipaustralia<1c>
-# 192.168.101.129 ipaustralia<1c>
-# 192.168.104.129 ipaustralia<1c>
-# 10.0.3.123 ipaustralia<1c>
-# 10.0.100.67 ipaustralia<1c>
-# tsitc> 
+=begin comment
+
+tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipaustralia#1c
+Sending queries to 192.168.1.29
+192.168.1.114 ipaustralia<1c>
+192.168.1.221 ipaustralia<1c>
+192.168.1.61 ipaustralia<1c>
+192.168.1.129 ipaustralia<1c>
+192.168.1.128 ipaustralia<1c>
+192.168.1.214 ipaustralia<1c>
+192.168.1.67 ipaustralia<1c>
+tsitc> 
+
+=end comment
+
+=cut
+
 
 my %x ;
 @found_dcs = grep { ! $x{$_}++ } @address2dc{ grep exists $address2dc{$_}, @addr_dcs_of_domain} ;
@@ -190,7 +189,7 @@ sub print_usage () {
 }
 
 sub print_help () {
-       print_revision($PROGNAME,'$Revision$ ');
+       print_revision($PROGNAME,'$Revision: 940 $ ');
        print "Copyright (c) 2001 Karl DeBisschop/S Hopcroft
 
 Perl Check WINS plugin for NetSaint.
@@ -237,7 +236,7 @@ The plugin works by
 }
 
 sub version () {
-       print_revision($PROGNAME,'$Revision$ ');
+       print_revision($PROGNAME,'$Revision: 940 $ ');
        exit $ERRORS{'OK'};
 }