- $stat->{$host}->{$port} .= substr($state,0,1);
- $stat->{$host}->{_count}->{$port} += $state =~ m/Up/ ? 1 : -1;
- } elsif ( m/(\S+)\s%STP-W-PORTSTATUS:\s([\w\/]+): STP status (\w+)/ ) {
- my ($host,$port,$state) = ($1,$2,$3);
- $stat->{$host}->{$port} .= '-';
- $stat->{$host}->{_count}->{$port} += $state =~ m/F/ ? 1 : -1;
+ stat_host_port( $host, $port, substr($state,0,1) );
+ } elsif ( m/(\S+)\s%STP-W-PORTSTATUS:\s([\w\/]+)(?: of instance \d+)?: STP status (\w+)/ ) {
+ my ($host,$port,$state) = ($1,$2,substr($3,0,1) );
+ stat_host_port( $host, $port, $state =~ m/f/i ? '-' : $state );