Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit ff81fa4

Browse files
ngarrattwillemdh
authored andcommitted
handle destination cluster peer connection diversity
1 parent 4e30fb2 commit ff81fa4

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

check_netapp_ontap.pl

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ sub get_cluster_health {
667667
my $nahClusterInfo = NaElement->new("cluster-peer-health-info");
668668
my $strActiveTag = "";
669669
my %hshClusterInfo;
670+
my %reachableClusters;
670671

671672
if (defined($strVHost)) {
672673
$nahClusterIterator->child_add($nahQuery);
@@ -690,11 +691,23 @@ sub get_cluster_health {
690691
}
691692

692693
foreach my $nahNode ($nahResponse->child_get("attributes-list")->children_get()) {
693-
my $strName = $nahNode->child_get_string("originating-node");
694-
$hshClusterInfo{$strName}{'destination'} = $nahNode->child_get_string("destination-node");
694+
my $originNode = $nahNode->child_get_string("originating-node");
695+
my $destinationNode = $nahNode->child_get_string("destination-node");
696+
my $destinationCluster = $nahNode->child_get_string("destination-cluster");
697+
my $strName = "${originNode}_${destinationNode}";
698+
$hshClusterInfo{$strName}{'origin'} = $originNode;
699+
$hshClusterInfo{$strName}{'destination'} = $destinationNode;
700+
$hshClusterInfo{$strName}{'destination-cluster'} = $destinationCluster;
695701
$hshClusterInfo{$strName}{'cluster-healthy'} = $nahNode->child_get_string("is-cluster-healthy");
696702
$hshClusterInfo{$strName}{'destination-available'} = $nahNode->child_get_string("is-destination-node-available");
697703
$hshClusterInfo{$strName}{'in-quorum'} = $nahNode->child_get_string("is-node-healthy");
704+
$reachableClusters{$destinationCluster} = $hshClusterInfo{$strName}{'destination-available'} eq 'true' ? 1 : 0;
705+
}
706+
}
707+
# Mark partially unreachable peers
708+
foreach (keys %hshClusterInfo) {
709+
if ($hshClusterInfo{$_}{'destination-available'} eq 'false' and $reachableClusters{$hshClusterInfo{$_}->{'destination-cluster'}} == 1) {
710+
$hshClusterInfo{$_}{'destination-available'} = 'partial';
698711
}
699712
}
700713

@@ -710,17 +723,21 @@ sub calc_cluster_health {
710723
foreach my $strNode (keys %$hrefClusterInfo) {
711724
$intObjectCount = $intObjectCount + 1;
712725
if ($hrefClusterInfo->{$strNode}->{'destination-available'} eq "false") {
713-
my $strNewMessage = $strNode . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " destination node is unavailable";
726+
my $strNewMessage = $hrefClusterInfo->{$strNode}->{'origin'} . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " destination node is unavailable";
714727
$strOutput = get_nagios_description($strOutput, $strNewMessage);
715728
$intState = get_nagios_state($intState, 2);
716729
} elsif ($hrefClusterInfo->{$strNode}->{'in-quorum'} eq "false") {
717-
my $strNewMessage = $strNode . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " originating node is not in quorum";
730+
my $strNewMessage = $hrefClusterInfo->{$strNode}->{'origin'} . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " originating node is not in quorum";
718731
$strOutput = get_nagios_description($strOutput, $strNewMessage);
719732
$intState = get_nagios_state($intState, 2);
720733
} elsif ($hrefClusterInfo->{$strNode}->{'cluster-healthy'} eq "false") {
721-
my $strNewMessage = $strNode . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " cluster peer relationship is unhealthy";
734+
my $strNewMessage = $hrefClusterInfo->{$strNode}->{'origin'} . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " cluster peer relationship is unhealthy";
722735
$strOutput = get_nagios_description($strOutput, $strNewMessage);
723736
$intState = get_nagios_state($intState, 2);
737+
} elsif ($hrefClusterInfo->{$strNode}->{'destination-available'} eq "partial") {
738+
my $strNewMessage = $hrefClusterInfo->{$strNode}->{'origin'} . "->" . $hrefClusterInfo->{$strNode}->{'destination'} . " destination node is partially unavailable";
739+
$strOutput = get_nagios_description($strOutput, $strNewMessage);
740+
$intState = get_nagios_state($intState, 1);
724741
}
725742
}
726743

0 commit comments

Comments
 (0)