summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-xplugins-scripts/check_ifstatus.pl45
-rwxr-xr-xplugins-scripts/check_rpc.pl6
2 files changed, 36 insertions, 15 deletions
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 38b87fc..f0b7c49 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -97,11 +97,12 @@ my $opt_V ;
97my $opt_u; 97my $opt_u;
98my $opt_n; 98my $opt_n;
99my $opt_x ; 99my $opt_x ;
100my $opt_d;
100my %excluded ; 101my %excluded ;
101my %unused_names ; 102my %unused_names ;
102my @unused_ports ; 103my @unused_ports ;
103my %session_opts; 104my %session_opts;
104 105my @exclude_descriptions;
105 106
106 107
107 108
@@ -134,6 +135,7 @@ if (!defined($session)) {
134} 135}
135 136
136 137
138push(@snmpoids,$snmpLocIfDescr);
137push(@snmpoids,$snmpIfOperStatus); 139push(@snmpoids,$snmpIfOperStatus);
138push(@snmpoids,$snmpIfAdminStatus); 140push(@snmpoids,$snmpIfAdminStatus);
139push(@snmpoids,$snmpIfDescr); 141push(@snmpoids,$snmpIfDescr);
@@ -180,18 +182,28 @@ foreach $key (keys %ifStatus) {
180 if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { 182 if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) {
181 #check only if interface is not excluded 183 #check only if interface is not excluded
182 if (!defined $unused_names{$ifStatus{$key}{$snmpIfDescr}} ) { 184 if (!defined $unused_names{$ifStatus{$key}{$snmpIfDescr}} ) {
183 # check only if interface type is not listed in %excluded 185 #check only if interface is not excluded (by description)
184 if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) { 186 #counter for matching descriptions
185 if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ; } 187 my $match_descr = 0;
186 if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { 188 foreach my $description (@exclude_descriptions) {
187 $ifdown++ ; 189 if ($ifStatus{$key}{$snmpLocIfDescr} =~ /^$description/) { $match_descr = 1; }
188 if (defined $ifXTable) { 190 }
189 $ifmessage .= sprintf("%s: down -> %s<BR>\n", $ifStatus{$key}{$snmpIfName}, $ifStatus{$key}{$snmpIfAlias}); 191 if ($match_descr == 0) {
190 }else{ 192 # check only if interface type is not listed in %excluded
191 $ifmessage .= sprintf("%s: down <BR>\n",$ifStatus{$key}{$snmpIfDescr}); 193 if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) {
192 } 194 if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ; }
195 if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) {
196 $ifdown++ ;
197 if (defined $ifXTable) {
198 $ifmessage .= sprintf("%s: down -> %s<BR>\n", $ifStatus{$key}{$snmpIfName}, $ifStatus{$key}{$snmpIfAlias});
199 }else{
200 $ifmessage .= sprintf("%s: down <BR>\n",$ifStatus{$key}{$snmpIfDescr});
201 }
202 }
203 if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;}
204 } else {
205 $ifexclude++;
193 } 206 }
194 if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;}
195 } else { 207 } else {
196 $ifexclude++; 208 $ifexclude++;
197 } 209 }
@@ -264,6 +276,9 @@ sub print_help() {
264 printf " the descriptive name. Do not use if you don't know what this is. \n"; 276 printf " the descriptive name. Do not use if you don't know what this is. \n";
265 printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n"; 277 printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n";
266 printf " from the report (default for an empty list is PPP(23).\n"; 278 printf " from the report (default for an empty list is PPP(23).\n";
279 printf " -d (--exclude_ports_by_description) A comma separated list of LocIfDescr values that should be excluded \n";
280 printf " from the report (default is an empty exclusion list). Done using regexp '/^arg/', ex:\n";
281 printf " '-d connect,test' will match with descriptions like 'testing phase' but not 'in testing'.\n";
267 printf " -n (--unused_ports_by_name) A comma separated list of ifDescr values that should be excluded \n"; 282 printf " -n (--unused_ports_by_name) A comma separated list of ifDescr values that should be excluded \n";
268 printf " from the report (default is an empty exclusion list).\n"; 283 printf " from the report (default is an empty exclusion list).\n";
269 printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n"; 284 printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n";
@@ -306,6 +321,7 @@ sub process_arguments() {
306 "I" => \$ifXTable, "ifmib" => \$ifXTable, 321 "I" => \$ifXTable, "ifmib" => \$ifXTable,
307 "x:s" => \$opt_x, "exclude:s" => \$opt_x, 322 "x:s" => \$opt_x, "exclude:s" => \$opt_x,
308 "u=s" => \$opt_u, "unused_ports=s" => \$opt_u, 323 "u=s" => \$opt_u, "unused_ports=s" => \$opt_u,
324 "d=s" => \$opt_d, "exclude_ports_by_description=s" => \$opt_d,
309 "n=s" => \$opt_n, "unused_ports_by_name=s" => \$opt_n, 325 "n=s" => \$opt_n, "unused_ports_by_name=s" => \$opt_n,
310 "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, 326 "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
311 "t=i" => \$timeout, "timeout=i" => \$timeout, 327 "t=i" => \$timeout, "timeout=i" => \$timeout,
@@ -414,6 +430,11 @@ sub process_arguments() {
414 } 430 }
415 } 431 }
416 432
433 # Exclude interfaces by descriptions
434 if (defined $opt_d) {
435 @exclude_descriptions = split(/,/,$opt_d);
436 }
437
417 # Excluded interface descriptors 438 # Excluded interface descriptors
418 if (defined $opt_n) { 439 if (defined $opt_n) {
419 my @unused = split(/,/,$opt_n); 440 my @unused = split(/,/,$opt_n);
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl
index 8a56b9f..0968982 100755
--- a/plugins-scripts/check_rpc.pl
+++ b/plugins-scripts/check_rpc.pl
@@ -311,18 +311,18 @@ sub get_rpcinfo {
311 printf "$line " if $verbose; 311 printf "$line " if $verbose;
312 chomp $line; 312 chomp $line;
313 313
314 if ( $line =~ /program $prognum version ([0-9]*) ready and waiting/ ) { 314 if ( $line =~ /[Pp]rogram $prognum version ([0-9]*) ready and waiting/ ) {
315 $response .= " version $1"; 315 $response .= " version $1";
316 $state = 'OK' unless $state ne 'UNKNOWN'; 316 $state = 'OK' unless $state ne 'UNKNOWN';
317 print "1:$response \n" if $verbose; 317 print "1:$response \n" if $verbose;
318 } 318 }
319 319
320 if ( $line =~ /program $prognum version ([0-9]*) is not available/ ) { 320 if ( $line =~ /[Pp]rogram $prognum version ([0-9]*) is not available/ ) {
321 $response2 .= " version $1"; 321 $response2 .= " version $1";
322 $state = 'CRITICAL'; 322 $state = 'CRITICAL';
323 print "2:$response2 \n" if $verbose; 323 print "2:$response2 \n" if $verbose;
324 } 324 }
325 if ( $line =~ /program $prognum is not available/ ) { 325 if ( $line =~ /[Pp]rogram $prognum is not available/ ) {
326 $response3 = ""; 326 $response3 = "";
327 $response3 = "tcp" if $opt_t; 327 $response3 = "tcp" if $opt_t;
328 $response3 = "udp" if $opt_u; 328 $response3 = "udp" if $opt_u;