Cluster down-juniper-junos

error
high-availability
junos
juniper
Cluster down-juniper-junos
0

#1

Cluster down-juniper-junos

Vendor: juniper

OS: junos

Description:
Indeni will alert if a cluster is down or any of the members are inoperable.

Remediation Steps:
Review the cause for one or more members being down or inoperable.

How does this work?
This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the “show chassis cluster status” command. The output includes the status of all redundancy groups across the cluster.

Why is this important?
Tracking the state of a cluster is important. If a cluster which used to be healthy no longer is, it may be the result of an issue. In some cases, it is due to maintenance work (and so was anticipated), but in others it may be due to a failure in the members of the cluster or another component in the network.

Without Indeni how would you find this?
The administrator has to run the “show chassis cluster status” on the device to find whether neither of cluster nodes is in primary state.

junos-show-chassis-cluster-status

#! META
name: junos-show-chassis-cluster-status
description: JUNOS collect clustering status
type: monitoring
monitoring_interval: 1 minute
requires:
    vendor: juniper
    os.name: junos
    product: firewall
    high-availability: true

#! COMMENTS
cluster-member-active:
    why: |
        Tracking the state of a cluster member is important. If a cluster member which used to be the active member of the cluster no longer is, it may be the result of an issue. In some cases, it is due to maintenance work (and so was anticipated), but in others it may be due to a failure in the firewall or another component in the network.
    how: |
        This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the "show chassis cluster status" command. The output includes the status of all redundancy groups across the cluster.
    without-indeni: |
        The administrator has to run the "show chassis cluster status" on the device to find whether the cluster member is active or not. 
    can-with-snmp: true
    can-with-syslog: true
cluster-state:
    why: |
        Tracking the state of a cluster is important. If a cluster which used to be healthy no longer is, it may be the result of an issue. In some cases, it is due to maintenance work (and so was anticipated), but in others it may be due to a failure in the members of the cluster or another component in the network.
    how: |
        This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the "show chassis cluster status" command. The output includes the status of all redundancy groups across the cluster.
    without-indeni: |
        The administrator has to run the "show chassis cluster status" on the device to find whether neither of cluster nodes is in primary state. 
    can-with-snmp: true
    can-with-syslog: true
cluster-preemption-enabled:
    why: |
        Preemption is a function in clustering which sets a primary member of the cluster to always strive to be the active member. The trouble with this is that if the active member that is set with preemption on has a critical failure and reboots, the cluster will fail over to the secondary and then immediately fail over back to the primary when it completes the reboot. This can result in another crash and the process would happen again and again in a loop.
    how: |
        This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the "show chassis cluster status" command. The output includes the status of all redundancy groups across the cluster.
    without-indeni: |
        The administrator has to run the "show chassis cluster status" on the device to find whether preemption is enabled and correctly configured if one of the nodes is expected to be always primary node. 
    can-with-snmp: false
    can-with-syslog: false

#! REMOTE::SSH
show chassis hardware node local | match node
show chassis cluster status

#! PARSER::AWK
BEGIN {
    RG = 0
}

#Node   Priority Status         Preempt Manual   Monitor-failures
/^Node.*Priority*/ {
    getColumns(trim($0), "[ \t]+", columns)
}

#Redundancy group: 0 , Failover count: 1
/^Redundancy group/ {
    regroup = $3
    group_state[regroup] = 0
    group_preempt [regroup] = 0
    RG = 1
    node_idx = 0
    cluster_tags["name"] = "redundancy group "regroup
}

#node0  1        primary        no      no       None           
/^node.*/ {
    if (RG == 0) {
       node_local = $1
       if (node_local ~ /node0/){
           myself = 0
       } else {
           myself = 1
       }
    } else {
        node = $getColId(columns, "Node")
        if (node == "node0") {
            node_idx == 0
        }else {
            node_idx = 1
        }

        statusDesc = $getColId(columns, "Status")
        monitor_failures = $getColId(columns, "Monitor-failures")

        if ( node_idx == myself ) {
            if ((statusDesc == "primary" && monitor_failures == "None") || (statusDesc == "secondary" && monitor_failures == "None")) {
                node_status[node_idx] = 1
            } else {
                node_status[node_idx] = 0
            }
            writeDoubleMetricWithLiveConfig("cluster-member-active", cluster_tags, "gauge", "60", node_status[myself], "Cluster Member Active", "state", "name")
        }
        node_idx++

        if (statusDesc == "primary" && monitor_failures == "None") {
            # either of nodes is primary, the state for this redundancy group is up
            group_state[regroup] = 1 
        }

        preempt = $getColId(columns, "Preempt")
        if (preempt == "yes") {
            group_preempt[regroup] = 1
        }
    }
}

END {
        for (regroup in group_state) {
            cluster_tags["name"] = "redundancy group "regroup
            writeDoubleMetricWithLiveConfig("cluster-state", cluster_tags, "gauge", "60", group_state[regroup], "Cluster State", "state", "name")
            writeDoubleMetricWithLiveConfig("cluster-preemption-enabled", cluster_tags, "gauge", "60", group_preempt[regroup], "Cluster Preemption Enabled", "boolean", "name")
        }
}

cross_vendor_cluster_down_vsx

package com.indeni.server.rules.library.templatebased.crossvendor

import com.indeni.server.rules.RuleContext
import com.indeni.server.rules.library.{ConditionalRemediationSteps, StateDownTemplateRule}

/**
  *
  */
case class cross_vendor_cluster_down_vsx(context: RuleContext) extends StateDownTemplateRule(context,
  ruleName = "cross_vendor_cluster_down_vsx",
  ruleFriendlyName = "Clustered Devices (VS): Cluster down",
  ruleDescription = "Indeni will alert if a cluster is down or any of the members are inoperable.",
  metricName = "cluster-state",
  applicableMetricTag = "name",
  descriptionMetricTag = "vs.name",
  alertItemsHeader = "Clustering Elements Affected",
  alertDescription = "One or more clustering elements in this device are down.\n\nThis alert was added per the request of <a target=\"_blank\" href=\"http://il.linkedin.com/pub/gal-vitenberg/83/484/103\">Gal Vitenberg</a>.",
  baseRemediationText = "Review the cause for one or more members being down or inoperable.")(
  ConditionalRemediationSteps.VENDOR_CP -> "Review other alerts for a cause for the cluster failure.",
  ConditionalRemediationSteps.VENDOR_PANOS -> "Log into the device over SSH and run \"less mp-log ha-agent.log\" for more information.",
  ConditionalRemediationSteps.OS_NXOS ->
    """|
      |1. Verify the communication between the FHRP peers. A random, momentary loss of data communication between the peers is the most common problem that results in continuous FHRP state change (ACT<-> STB) unless this error message occurs during the initial installation.
      |2. Check the CPU utilization by using the "show process CPU" NX-OS command. HSRP state changes are often due to High CPU Utilization.
      |3. Common problems for the loss of FHRP packets between the peers to investigate are physical layer problems, excessive network traffic caused by spanning tree issues or excessive traffic caused by each Vlan.
      |
      |A vPC problem could cause the change to the state so check the next :
      |1. Check that STP bridge assurance is not enabled on the vPC links. Bridge assurance should only be enabled on the vPC peer link
      |2. Compare the vPC domain IDs of the two switches and ensure that they match. Execute the "show vpc brief"  to compare the output that should match across the vPC peer switches.
      |3. Verify that both the source and destination IP addresses used for the peer-keepalive messages are reachable from the VRF associated with the vPC peer-keepalive link.
      |Then, execute the "sh vpc peer-keepalive" NX-OS command and review the output from both switches.
      |4. Verify that the peer-keepalive link is up. Otherwise, the vPC peer link will not come up.
      |5. Review the vPC peer link configuration, execute the "sh vpc brief" NX-OS command and review the output. Besides, verify that the vPC peer link is configured as a Layer 2 port channel trunk that allows only vPC VLANs.
      |6. Ensure that type 1 consistency parameters match. If they do not match, then vPC is suspended. Items that are type 2 do not have to match on both Nexus switches for the vPC to be operational. Execute the "sh vpc consistency-parameters" command and review the output
      |7. Verify that the vPC number that you assigned to the port channel that connects to the downstream device from the vPC peer device is identical on both vPC peer devices
      |8. If you manually configured the system priority, verify that you assigned the same priority value on both vPC peer devices
      |9. Verify that the primary vPC is the primary STP root and the secondary vPC is the secondary STP root.
      |10. Review the logs for relevant findings
      |11. For more information please review  the next  vPC troubleshooting guide:
      |https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus5000/sw/troubleshooting/guide/N5K_Troubleshooting_Guide/n5K_ts_vpc.html""".stripMargin

)