PIM neighbor(s) down-juniper-junos

junos
health-checks
juniper
critical
PIM neighbor(s) down-juniper-junos
0

#1

PIM neighbor(s) down-juniper-junos

Vendor: juniper

OS: junos

Description:
indeni will trigger an issue if one or more PIM neighbors isn’t communicating well.

Remediation Steps:
Review the cause for the neighbors being down.
|||1. Run the “show pim neighbors detail” command to view PIM neighbors and their status.
|2. Run the “show pim interfaces” command to view PIM configured on the interfaces.
|3. Run the "show pim join extensive group " command to check if the state of PIM join and up/down interfaces is correct.
|4. Review the following article on Juniper TechLibrary for more information: Resolution Guide - Troubleshoot Multicast issue with Junos OS device configured as Layer 3 (running PIM protocol).

How does this work?
This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the “show pim neighbors” command. The output includes the status of active PIM neighbors. indeni will look for a neighbor disappearing from this list.

Why is this important?
Due to the dynamic nature of PIM, it should be closely monitored to verify that it is working correctly. Since routing is a vital part of any network, a failure or issues in dynamic routing can cause large disruptions.

Without Indeni how would you find this?
An administrator could login and manually run the command. SNMP traps and syslogs are also available to be aware of a PIM issue.

junos-show-pim-neighbors

#! META
name: junos-show-pim-neighbors
description: JUNOS get PIM neighbor information
type: monitoring
monitoring_interval: 5 minute
requires:
    vendor: juniper
    os.name: junos

#! COMMENTS
pim-state:
    why: |
        Due to the dynamic nature of PIM, it should be closely monitored to verify that it is working correctly. Since routing is a vital part of any network, a failure or issues in dynamic routing can cause large disruptions.
    how: |
        This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the "show pim neighbors" command. The output includes the status of active PIM neighbors. indeni will look for a neighbor disappearing from this list.
    without-indeni: |
        An administrator could login and manually run the command. SNMP traps and syslogs are also available to be aware of a PIM issue.
    can-with-snmp: true
    can-with-syslog: true
    vendor-provided-management: |
        Listing PIM neighbors is only available from the command line.

#! REMOTE::SSH
show pim neighbors

#! PARSER::AWK

# Interface           IP V Mode        Option      Uptime Neighbor addr
# so-1/0/0.0           4 2             HPLG      00:07:10 10.111.10.2

# Make sure line ends with some ID
/[0-9\.]{4}$/ {
    # Verify we have the number of columns we thought we would
    if (NF == 6) {
        name_tag["name"] = $6

        up = 1  # if it's in the list, it's up

        writeDoubleMetricWithLiveConfig("pim-state", name_tag, "gauge", "60", up, "PIM Neighbors", "state", "name")
    }
}

cross_vendor_pim_neighbor_down

package com.indeni.server.rules.library

import com.indeni.apidata.time.TimeSpan
import com.indeni.ruleengine.expressions.conditions.GreaterThan
import com.indeni.ruleengine.expressions.core.{StatusTreeExpression, _}
import com.indeni.ruleengine.expressions.data.{SelectTagsExpression, SelectTimeSeriesExpression, TimeSeriesExpression}
import com.indeni.ruleengine.expressions.ts.TimeSinceLastValueExpression
import com.indeni.server.common.data.conditions.True
import com.indeni.server.params.ParameterDefinition
import com.indeni.server.params.ParameterDefinition.UIType
import com.indeni.server.rules._
import com.indeni.server.rules.library.core.PerDeviceRule
import com.indeni.server.sensor.models.managementprocess.alerts.dto.AlertSeverity


case class PimNeighborIsDownRule() extends PerDeviceRule with RuleHelper {

  private val highThresholdParameterName = "High_Threshold_of_Downtime"
  private val highThresholdParameter = new ParameterDefinition(highThresholdParameterName,
    "",
    "High Threshold of Downtime",
    "If a peer device is down or not communicating for at least this amount of time, an issue will be triggered.",
    UIType.TIMESPAN,
    TimeSpan.fromMinutes(15))

  override val metadata: RuleMetadata = RuleMetadata.builder("cross_vendor_pim_neighbor_down", "All Devices: PIM neighbor(s) down",
    "indeni will trigger an issue if one or more PIM neighbors isn't communicating well.", AlertSeverity.CRITICAL).configParameter(highThresholdParameter).build()

  override def expressionTree(context: RuleContext): StatusTreeExpression = {
    val threshold = getParameterTimeSpanForRule(highThresholdParameter).noneable

    StatusTreeExpression(
      // Which objects to pull (normally, devices)
      SelectTagsExpression(context.metaDao, Set(DeviceKey), True),

      // What constitutes an issue
      StatusTreeExpression(

        // The additional tags we care about (we'll be including this in alert data)
        SelectTagsExpression(context.tsDao, Set("name"), withTagsCondition("pim-state")),

        StatusTreeExpression(
          SelectTimeSeriesExpression[Double](context.tsDao, Set("pim-state"), ConstantExpression(TimeSpan.fromDays(1)), denseOnly = false),
          GreaterThan(TimeSinceLastValueExpression(TimeSeriesExpression("pim-state"), Some(1.0)), threshold)
        ).withSecondaryInfo(
          scopableStringFormatExpression("${scope(\"name\")}"),
          EMPTY_STRING,
          title = "Neighbors Affected"
        ).asCondition()
      ).withoutInfo().asCondition()
    ).withRootInfo(
      getHeadline(),
      ConstantExpression("One or more PIM neighbors are down."),
      ConditionalRemediationSteps("Review the cause for the neighbors being down.",
        ConditionalRemediationSteps.OS_NXOS ->
          """1. Check whether PIM is configured on the interfaces with the "show ip pim interface" command.
            |2. Use the "show ip pim neighbors" NX-OS  command to list the Protocol Independent Multicast (PIM) neighbors and review the status.
            |3. For more information review: <a target="_blank" href="http://www.cisco.com/c/en/us/support/docs/ip/ip-multicast/16450-mcastguide0.html">Multicast troubleshooting guide</a>.""".stripMargin,
        ConditionalRemediationSteps.VENDOR_JUNIPER ->
          """|1. Run the "show pim neighbors detail" command to view PIM neighbors and their status.
             |2. Run the "show pim interfaces" command to view PIM configured on the interfaces.
             |3. Run the "show pim join extensive group <group address>" command to check if the state of PIM join and up/down interfaces is correct.
             |4. Review the following article on Juniper TechLibrary for more information: <a target="_blank" href="https://kb.juniper.net/InfoCenter/index?page=content&id=KB21586&actp=METADATA">Resolution Guide - Troubleshoot Multicast issue with Junos OS device configured as Layer 3 (running PIM protocol)</a>.""".stripMargin
      )
    )
  }
}