summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanley Hopcroft <stanleyhopcroft@users.sourceforge.net>2004-11-25 04:46:16 (GMT)
committerStanley Hopcroft <stanleyhopcroft@users.sourceforge.net>2004-11-25 04:46:16 (GMT)
commit664de27e8572a14d95d53e73c4c16bb7cbb465a0 (patch)
treedadcab2bc6363a1ffb17b5109108f564185dc22b
parent3d3d53f407c8e5c355a0175b9f49d47a40131026 (diff)
downloadmonitoring-plugins-664de27e8572a14d95d53e73c4c16bb7cbb465a0.tar.gz
Non functional tidy ups to check_wins
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@940 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-xcontrib/check_wins.pl67
1 files changed, 32 insertions, 35 deletions
diff --git a/contrib/check_wins.pl b/contrib/check_wins.pl
index 9ea7c45..0d11737 100755
--- a/contrib/check_wins.pl
+++ b/contrib/check_wins.pl
@@ -3,6 +3,9 @@
3# $Id$ 3# $Id$
4 4
5# $Log$ 5# $Log$
6# Revision 1.3 2004/11/25 04:46:16 stanleyhopcroft
7# Non functional tidy ups to check_wins
8#
6# Revision 1.2 2003/08/20 08:31:49 tonvoon 9# Revision 1.2 2003/08/20 08:31:49 tonvoon
7# Changed netsaint to nagios in use lib 10# Changed netsaint to nagios in use lib
8# 11#
@@ -22,7 +25,6 @@ my $PROGNAME = 'check_wins' ;
22 25
23use constant SAMBA_DEBUG_LVL => 2 ; 26use constant SAMBA_DEBUG_LVL => 2 ;
24use constant MY_DCS => ('dc1','dc2') ; 27use constant MY_DCS => ('dc1','dc2') ;
25# use constant MY_DCS => qw(ipa01 ipa02 ipa03) ;
26 28
27my $NMBLOOKUP_PATH = '/usr/bin/nmblookup' ; 29my $NMBLOOKUP_PATH = '/usr/bin/nmblookup' ;
28my $NMBLOOKUP = sub { return `$NMBLOOKUP_PATH $_[2] -R -U $_[0] $_[1]` } ; 30my $NMBLOOKUP = sub { return `$NMBLOOKUP_PATH $_[2] -R -U $_[0] $_[1]` } ;
@@ -67,8 +69,8 @@ my (@addr_dcs_of_domain, @found_dcs, %address2dc) ;
67my (@dc_query) ; 69my (@dc_query) ;
68 70
69# tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipa01 71# tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipa01
70# Sending queries to 10.0.100.29 72# Sending queries to 192.168.1.29
71# 10.0.100.16 ipa01<00> 73# 192.168.1.16 ipa01<00>
72 74
73eval { 75eval {
74 alarm($TIMEOUT) ; 76 alarm($TIMEOUT) ;
@@ -93,11 +95,17 @@ if ( scalar grep(/name_query failed/, @dc_query) ) {
93 exit $ERRORS{"CRITICAL"} ; 95 exit $ERRORS{"CRITICAL"} ;
94} 96}
95 97
96# the results of looking up the DCs (by their name) in the WINS 98=begin comment
99
100the results of looking up the DCs (by their name) in the WINS
101
102192.168.1.16 ipa01<20>
103192.168.1.1 ipa02<20>
104192.168.1.104 ipa03<20>
105
106=end comment
97 107
98# 10.0.100.16 ipa01<20> 108=cut
99# 10.0.100.1 ipa02<20>
100# 10.0.100.104 ipa03<20>
101 109
102@dc_addresses = () ; 110@dc_addresses = () ;
103foreach (@dc_query) { 111foreach (@dc_query) {
@@ -129,34 +137,23 @@ shift @dcs_of_domain ;
129chomp @dcs_of_domain ; 137chomp @dcs_of_domain ;
130@addr_dcs_of_domain = map /^(\S+)/, @dcs_of_domain ; 138@addr_dcs_of_domain = map /^(\S+)/, @dcs_of_domain ;
131 139
132# tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipaustralia#1c 140=begin comment
133# Sending queries to 10.0.100.29 141
134# 10.0.100.114 ipaustralia<1c> 142tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipaustralia#1c
135# 168.168.102.129 ipaustralia<1c> 143Sending queries to 192.168.1.29
136# 192.168.101.221 ipaustralia<1c> 144192.168.1.114 ipaustralia<1c>
137# 10.0.100.61 ipaustralia<1c> 145192.168.1.221 ipaustralia<1c>
138# 192.168.108.129 ipaustralia<1c> 146192.168.1.61 ipaustralia<1c>
139# 192.168.102.128 ipaustralia<1c> 147192.168.1.129 ipaustralia<1c>
140# 10.0.4.126 ipaustralia<1c> 148192.168.1.128 ipaustralia<1c>
141# 192.168.106.214 ipaustralia<1c> 149192.168.1.214 ipaustralia<1c>
142# 10.0.3.165 ipaustralia<1c> 150192.168.1.67 ipaustralia<1c>
143# 192.168.105.214 ipaustralia<1c> 151tsitc>
144# 10.0.6.145 ipaustralia<1c> 152
145# 192.168.104.128 ipaustralia<1c> 153=end comment
146# 10.0.4.59 ipaustralia<1c> 154
147# 10.9.99.99 ipaustralia<1c> 155=cut
148# 10.99.99.99 ipaustralia<1c> 156
149# 10.9.99.254 ipaustralia<1c>
150# 10.0.3.15 ipaustralia<1c>
151# 192.168.102.129 ipaustralia<1c>
152# 192.168.103.129 ipaustralia<1c>
153# 192.168.105.129 ipaustralia<1c>
154# 192.168.106.129 ipaustralia<1c>
155# 192.168.101.129 ipaustralia<1c>
156# 192.168.104.129 ipaustralia<1c>
157# 10.0.3.123 ipaustralia<1c>
158# 10.0.100.67 ipaustralia<1c>
159# tsitc>
160 157
161my %x ; 158my %x ;
162@found_dcs = grep { ! $x{$_}++ } @address2dc{ grep exists $address2dc{$_}, @addr_dcs_of_domain} ; 159@found_dcs = grep { ! $x{$_}++ } @address2dc{ grep exists $address2dc{$_}, @addr_dcs_of_domain} ;