diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/check_wins.pl | 67 |
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 | ||
23 | use constant SAMBA_DEBUG_LVL => 2 ; | 26 | use constant SAMBA_DEBUG_LVL => 2 ; |
24 | use constant MY_DCS => ('dc1','dc2') ; | 27 | use constant MY_DCS => ('dc1','dc2') ; |
25 | # use constant MY_DCS => qw(ipa01 ipa02 ipa03) ; | ||
26 | 28 | ||
27 | my $NMBLOOKUP_PATH = '/usr/bin/nmblookup' ; | 29 | my $NMBLOOKUP_PATH = '/usr/bin/nmblookup' ; |
28 | my $NMBLOOKUP = sub { return `$NMBLOOKUP_PATH $_[2] -R -U $_[0] $_[1]` } ; | 30 | my $NMBLOOKUP = sub { return `$NMBLOOKUP_PATH $_[2] -R -U $_[0] $_[1]` } ; |
@@ -67,8 +69,8 @@ my (@addr_dcs_of_domain, @found_dcs, %address2dc) ; | |||
67 | my (@dc_query) ; | 69 | my (@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 | ||
73 | eval { | 75 | eval { |
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 | |||
100 | the results of looking up the DCs (by their name) in the WINS | ||
101 | |||
102 | 192.168.1.16 ipa01<20> | ||
103 | 192.168.1.1 ipa02<20> | ||
104 | 192.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 = () ; |
103 | foreach (@dc_query) { | 111 | foreach (@dc_query) { |
@@ -129,34 +137,23 @@ shift @dcs_of_domain ; | |||
129 | chomp @dcs_of_domain ; | 137 | chomp @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> | 142 | tsitc> /usr/local/samba/bin/nmblookup -R -U wins ipaustralia#1c |
135 | # 168.168.102.129 ipaustralia<1c> | 143 | Sending queries to 192.168.1.29 |
136 | # 192.168.101.221 ipaustralia<1c> | 144 | 192.168.1.114 ipaustralia<1c> |
137 | # 10.0.100.61 ipaustralia<1c> | 145 | 192.168.1.221 ipaustralia<1c> |
138 | # 192.168.108.129 ipaustralia<1c> | 146 | 192.168.1.61 ipaustralia<1c> |
139 | # 192.168.102.128 ipaustralia<1c> | 147 | 192.168.1.129 ipaustralia<1c> |
140 | # 10.0.4.126 ipaustralia<1c> | 148 | 192.168.1.128 ipaustralia<1c> |
141 | # 192.168.106.214 ipaustralia<1c> | 149 | 192.168.1.214 ipaustralia<1c> |
142 | # 10.0.3.165 ipaustralia<1c> | 150 | 192.168.1.67 ipaustralia<1c> |
143 | # 192.168.105.214 ipaustralia<1c> | 151 | tsitc> |
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 | ||
161 | my %x ; | 158 | my %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} ; |