BGP peer(s) down-juniper-junos

error
health-checks
junos
juniper
BGP peer(s) down-juniper-junos
0

#1

BGP peer(s) down-juniper-junos

Vendor: juniper

OS: junos

Description:
Indeni will alert one or more BGP peers isn’t communicating well.

Remediation Steps:
Review the cause for the peers being down.

How does this work?
This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the “show bgp neighbor” command. The output includes the status of active/established/inactive BGP neighbors.

Why is this important?
Due to the dynamic nature of BGP, 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.

junos-show-bgp-neighbor

#! META
name: junos-show-bgp-neighbor
description: Retrieve BGP neighbor information
type: monitoring
monitoring_interval: 1 minute
requires:
    vendor: juniper
    os.name: junos

#! COMMENTS
bgp-received-routes:
    skip-documentation: true
bgp-state:
    why: |
        Due to the dynamic nature of BGP, 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 bgp neighbor" command. The output includes the status of active/established/inactive BGP neighbors.
    without-indeni: |
        An administrator could login and manually run the command. 
    can-with-snmp: false 
    can-with-syslog: true
    vendor-provided-management: |
        Listing BGP neighbors is only available from the command line.

#! REMOTE::SSH
show bgp summary

#! PARSER::AWK

#128.208.95.1          65007        536        528       0       0     3:55:44 0/6/5/0              0/0/0/0
/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/ {

    nameTag["name"]  = $1;
    if ($0 ~ /Active/ || $0 ~ /Connect/ || $0 ~ /Idle/) {
        peerState = "0"
    } else {
        peerState = "1"
    }
    writeDoubleMetricWithLiveConfig("bgp-state", nameTag, "gauge", "60", peerState, "BGP Neighbor", "state", "name")

    #99.99.99.2              555         35         38       0       0       12:05 Establ
    bgpState = $(NF)
    if (peerState == "1" && bgpState !~ /Establ/) {
        routes = $(NF-1)
        split (routes, route, "/")
        writeDoubleMetricWithLiveConfig("bgp-received-routes", nameTag, "number", "60", route[2], "BGP Neighbor", "number", "name")
    } 
}

#  bgp.evpn.0: 9/9/9/0
/^(\s \w)/ {
    bgpTable = $1
    gsub(/\:/, "", bgpTable)
    logicalSystemNameTag["name"] = nameTag["name"]
    logicalSystemNameTag["name"] = logicalSystemNameTag["name"] ":" bgpTable
    routes = $(NF)
    split (routes, route, "/")
    writeDoubleMetricWithLiveConfig("bgp-received-routes", logicalSystemNameTag, "number", "60", route[2], "BGP Neighbor", "number", "name")
}

cross_vendor_bgp_peer_down

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_bgp_peer_down(context: RuleContext) extends StateDownTemplateRule(context,
  ruleName = "cross_vendor_bgp_peer_down",
  ruleFriendlyName = "All Devices: BGP peer(s) down",
  ruleDescription = "Indeni will alert one or more BGP peers isn't communicating well.",
  metricName = "bgp-state",
  applicableMetricTag = "name",
  alertItemsHeader = "Peers Affected",
  alertDescription = "One or more BGP peers are down.",
  baseRemediationText = "Review the cause for the peers being down.")(
  ConditionalRemediationSteps.VENDOR_CP -> "Consider reading Tobias Lachmann's blog on BGP: https://blog.lachmann.org/?p=1771",
  ConditionalRemediationSteps.VENDOR_PANOS -> "Consider starting at https://live.paloaltonetworks.com/t5/Configuration-Articles/BGP-Routes-are-not-Injected-into-the-Routing-Table/ta-p/54938 . You can also log into the device over SSH and run \"less mp-log routed.log\".",
  ConditionalRemediationSteps.OS_NXOS ->
    """|
      |1. Get information for all BGP neighbors by running the "show bgp vrf all sessions" NX-OS command
      |2. Get a summary list of BGP neighbors and statistics by executing the "show ip bgp vrf all summary" NX-OS command
      |3. Get detailed information from a BGP neighbor by running the "show ip bgp neighbors X.X.X.X" NX-OS command
      |4. Check global BGP process information with the "show bgp process" NX-OS command
      |5. Review the logs for relevant findings
      |6. For more information please review  following CISCO BGP troubleshooting flow chart:
      |https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/22166-bgp-trouble-main.html#anc6""".stripMargin
)
{
  override val deviceCondition = generateDevicePassiveAndPassiveLinkStateCondition(context.tsDao)
}