Maximum number of routes nearing (IPv4)-juniper-junos

error
health-checks
best-practices
junos
juniper
Maximum number of routes nearing (IPv4)-juniper-junos
0

#1

Maximum number of routes nearing (IPv4)-juniper-junos

Vendor: juniper

OS: junos

Description:
Many devices have a limit for the number of IPv4 routes that can be defined. Indeni will alert prior to the number of routes reaching the limit.

Remediation Steps:
Consider removing certain routes.

How does this work?
This script retrieves the total of routes on the device by running “show route summary” command.

Why is this important?
The number of routes might have negative impact on the device.

Without Indeni how would you find this?
An administrator could log on to the device to run the command “show route summary” to collect the same information.

junos-show-route-summary

#! META
name: junos-show-route-summary
description: JUNOS retrieving the total of routes 
type: monitoring
monitoring_interval: 5 minute
requires:
    vendor: juniper
    os.name: junos

#! COMMENTS
routes-limit:
    why: |
        The SRX allows to configure a limit for the number of routes installed in a routing table based upon the route prefix.
    how: |
        This script retrieves the maximum-prefixes configured on the SRX device by running "show route summary" command.
    without-indeni: |
        An administrator could log on to the device to run the command "show route summary" to collect the same information.
    can-with-snmp: false
    can-with-syslog: false
    vendor-provided-management: |
        The commamnd line is available to retrieve this information

routes-usage:
    why: |
        The number of routes might have negative impact on the device. 
    how: |
        This script retrieves the total of routes on the device by running "show route summary" command. 
    without-indeni: |
        An administrator could log on to the device to run the command "show route summary" to collect the same information.
    can-with-snmp: false 
    can-with-syslog: false
    vendor-provided-management: |
        The commamnd line is available to retrieve this information

#! REMOTE::SSH
show route summary 

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

#Limit/Threshold: 100/100 destinations 200/200 routes
/^(Limit\/Threshold:)/ {
    PrefixLimit = $2
    split(PrefixLimit, PrefixLimitArray, "/") 
    writeDoubleMetric("routes-limit", null, "gauge", 60, PrefixLimitArray[1])
}

#inet.0: 15 destinations, 22 routes (15 active, 0 holddown, 0 hidden)
/inet/ {
   inet_table = $1
   gsub("\:", "", inet_table )
   name_tag["name"] = inet_table 
   total_for_table = $4
   writeDoubleMetric("routes-usage", name_tag, "gauge", 60, total_for_table)
   total_routes = total_routes + total_for_table 
}

END {
   name_tag["name"] = "total-routes" 
   writeDoubleMetric("routes-usage", name_tag, "gauge", 60, total_routes)

}

junos-show-route-summary

#! META
name: junos-show-route-summary
description: JUNOS retrieving the total of routes 
type: monitoring
monitoring_interval: 5 minute
requires:
    vendor: juniper
    os.name: junos

#! COMMENTS
routes-limit:
    why: |
        The SRX allows to configure a limit for the number of routes installed in a routing table based upon the route prefix.
    how: |
        This script retrieves the maximum-prefixes configured on the SRX device by running "show route summary" command.
    without-indeni: |
        An administrator could log on to the device to run the command "show route summary" to collect the same information.
    can-with-snmp: false
    can-with-syslog: false
    vendor-provided-management: |
        The commamnd line is available to retrieve this information

routes-usage:
    why: |
        The number of routes might have negative impact on the device. 
    how: |
        This script retrieves the total of routes on the device by running "show route summary" command. 
    without-indeni: |
        An administrator could log on to the device to run the command "show route summary" to collect the same information.
    can-with-snmp: false 
    can-with-syslog: false
    vendor-provided-management: |
        The commamnd line is available to retrieve this information

#! REMOTE::SSH
show route summary 

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

#Limit/Threshold: 100/100 destinations 200/200 routes
/^(Limit\/Threshold:)/ {
    PrefixLimit = $2
    split(PrefixLimit, PrefixLimitArray, "/") 
    writeDoubleMetric("routes-limit", null, "gauge", 60, PrefixLimitArray[1])
}

#inet.0: 15 destinations, 22 routes (15 active, 0 holddown, 0 hidden)
/inet/ {
   inet_table = $1
   gsub("\:", "", inet_table )
   name_tag["name"] = inet_table 
   total_for_table = $4
   writeDoubleMetric("routes-usage", name_tag, "gauge", 60, total_for_table)
   total_routes = total_routes + total_for_table 
}

END {
   name_tag["name"] = "total-routes" 
   writeDoubleMetric("routes-usage", name_tag, "gauge", 60, total_routes)

}

routes_defined_limit

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

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

/**
  *
  */
case class routes_defined_limit(context: RuleContext) extends NearingCapacityTemplateRule(context,
  ruleName = "routes_defined_limit",
  ruleFriendlyName = "All Devices: Maximum number of routes nearing (IPv4)",
  ruleDescription = "Many devices have a limit for the number of IPv4 routes that can be defined. Indeni will alert prior to the number of routes reaching the limit.",
  usageMetricName = "routes-usage",
  limitMetricName = "routes-limit",
  threshold = 80.0,
  alertDescriptionFormat = "There are %.0f IPv4 routes defined where the limit is %.0f.",
  baseRemediationText = "Consider removing certain routes.")(
  ConditionalRemediationSteps.OS_NXOS ->
    """|
      |1. Execute the "show ip route summary" command to display the current contents of the IPv4 routing table in summary format.
      |2. Consider to deploy route summarization to decrease the  total number of ipv4 prefixes.
      |3. Consider to clean up the configuration from unused routes.
    """.stripMargin
)