Random Project

Couple of fixes for the portstate

Great plugin!
I have fixed a couple of bugs.

1. No more duplicates when check one port (with a –port option) and not all of them.
2. Now is able to check several ports at one time. Syntax example: poststate –SP A –port 1,3.

— check_emc_clariion.pl.orig 2013-03-09 14:54:48.000000000 +0100
+++ check_emc_clariion.pl 2013-03-19 08:25:43.000000000 +0100
@@ -1103,7 +1103,7 @@
$sp_line = 1;
}
# check for requested port id
– if ($opt_port >=0) {
+ if ($opt_port =~ /^d+$/) {
if( $_ =~ m/^SPsPortsID:s+($opt_port)$/) {
$port_id = $1;
$portstate_line = 1;
@@ -1165,14 +1165,11 @@
$output .= “Connection Type: $type. “;
}
# end of section
– if ( $_ =~ m/^s*$/) {
– $portstate_line = 0;
– ### $sp_section = 0;
– if ($opt_port >=0 ) {
– $sp_section = 0;
– }
– $sp_line = 0;
– }
+ }
+ if ( $_ =~ m/^s*$/) {
+ $portstate_line = 0;
+ $sp_section = 0;
+ $sp_line = 0;
}
}
close (NAVICLIOUT);