PIM neighbor(s) down-juniper-junos

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

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.
        can-with-snmp: true
        can-with-syslog: true
steps:
-   run:
        type: SSH
        command: show pim neighbors
    parse:
        type: AWK
        file: show-pim-neighbors.parser.1.awk

cross_vendor_pim_neighbor_down

package com.indeni.server.rules.library.core
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, StepTimeSeriesExpression, 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.{ConditionalRemediationSteps, PerDeviceRule, RuleHelper}
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", "PIM neighbor(s) down",
    "indeni will trigger an issue if one or more PIM neighbors isn't communicating well.", AlertSeverity.CRITICAL, categories = Set(RuleCategory.HealthChecks), deviceCategory = DeviceCategory.AllDevices).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[Double]("pim-state"),StepTimeSeriesExpression("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.",
        RemediationStepCondition.VENDOR_CISCO ->
          """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,
        RemediationStepCondition.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
      )
    )
  }
}