zabbix_export: version: '6.0' date: '2021-11-21T22:04:29Z' groups: - uuid: e0242822f07b4633a283b8dc935d3dd9 name: Templates_Created templates: - uuid: 6bf016389ccf49c8b491ac73c41a4fd0 template: 'BGPv4 SNMP' name: 'BGPv4 SNMP' description: | ## Description Template BGPv4 Sessions -Admin Status -Established Time -Operation Status -AS Name -BGP last Error By: Flavio Gomes Figueira Camacho Junior Require: ValueMaps .BGP4-MIB::bgpPeerAdminStatus .BGP4-MIB::bgpPeerState ExternalScript .as_name Base: BGP4-MIB.mib https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml ## Overview Template BGPv4 Sessions -Admin Status -Established Time -Operation Status -AS Name -BGP last Error By: Flavio Gomes Figueira Camacho Junior Require: ValueMaps .BGP4-MIB::bgpPeerAdminStatus .BGP4-MIB::bgpPeerState ExternalScript .as\_name Base: BGP4-MIB.mib External Scripts and Value Mapping on my Github: https://github.com/flaviojunior1995/Zabbix-Templates ## Author Flavio Camacho Junior groups: - name: Templates_Created discovery_rules: - uuid: 860002e447bb45bca37b3c75527d38ee name: 'BGPv4 Peers Discovery' type: SNMP_AGENT snmp_oid: 'discovery[{#SNMPVALUE},.1.3.6.1.2.1.15.3.1.7,{#SNMPASN},.1.3.6.1.2.1.15.3.1.9]' key: BgpPeerDiscovery delay: 1h lifetime: 7d item_prototypes: - uuid: 9b1be237207d4e45bdd916f3b7af5a48 name: 'AS Name for IPv4 peer $1' type: EXTERNAL key: 'as_name["{#SNMPVALUE}","{#SNMPASN}"]' delay: 1d history: 7d trends: '0' value_type: CHAR tags: - tag: Application value: BGPv4 - tag: Application value: 'BGPv4 {#SNMPVALUE}' - uuid: 44dbf3e1fac84ff8a70047810ee08a62 name: 'Administrative status for peer $1' type: SNMP_AGENT snmp_oid: '1.3.6.1.2.1.15.3.1.3.{#SNMPVALUE}' key: 'bgpPeerAdminStatus[{#SNMPVALUE}]' delay: 10m history: 7d trends: '0' valuemap: name: 'BGP4-MIB::bgpPeerAdminStatus' tags: - tag: Application value: BGPv4 - tag: Application value: 'BGPv4 {#SNMPVALUE}' - uuid: 28010bead7854f5c871557f5b6dd9681 name: 'Established time for peer $1' type: SNMP_AGENT snmp_oid: '1.3.6.1.2.1.15.3.1.16.{#SNMPVALUE}' key: 'bgpPeerFsmEstablishedTime[{#SNMPVALUE}]' delay: 10m history: 30d trends: '0' units: uptime tags: - tag: Application value: BGPv4 - tag: Application value: 'BGPv4 {#SNMPVALUE}' trigger_prototypes: - uuid: bca14f8136ae4df9ad04c56c7399ac53 expression: 'last(/BGPv4 SNMP/bgpPeerFsmEstablishedTime[{#SNMPVALUE}])<{$PEER_LOW_TIME}' name: 'BGP peer up time low {#SNMPVALUE} ASN {#SNMPASN}' priority: INFO dependencies: - name: 'BGP peer {#SNMPVALUE} ASN {#SNMPASN} is DOWN' expression: 'last(/BGPv4 SNMP/bgpPeerState[{#SNMPVALUE}],#3)<>6 and last(/BGPv4 SNMP/bgpPeerAdminStatus[{#SNMPVALUE}])=2' - uuid: fb9b74ba11ee4b62a38cfde81f0593f4 name: 'BGP peer last error {#SNMPVALUE}' type: SNMP_AGENT snmp_oid: '1.3.6.1.2.1.15.3.1.14.{#SNMPVALUE}' key: 'bgpPeerLastError[{#SNMPVALUE}]' delay: 10m history: 30d trends: '0' value_type: CHAR preprocessing: - type: JAVASCRIPT parameters: - | value = (value.replace(/\s+/g, '')); if (value === "0000") { return "NO last error" } if (value === "0100") { return "Message Header Error - Unspecific" } if (value === "0101") { return "Message Header Error - Connection Not Synchronized" } if (value === "0102") { return "Message Header Error - Bad Message Length" } if (value === "0103") { return "Message Header Error - Bad Message Type" } if (value === "0200") { return "OPEN Message Error - Unspecific" } if (value === "0201") { return "OPEN Message Error - Unsupported Version Number" } if (value === "0202") { return "OPEN Message Error - Bad Peer AS" } if (value === "0203") { return "OPEN Message Error - Bad BGP Identifier" } if (value === "0204") { return "OPEN Message Error - Unsupported Optional Parameter" } if (value === "0205") { return "OPEN Message Error - [Deprecated]" } if (value === "0206") { return "OPEN Message Error - Unacceptable Hold Time" } if (value === "0207") { return "OPEN Message Error - Unsupported Capability"; } if (value === "0208") { return "OPEN Message Error - Role Mismatch (Expire on 2021-03-29)" } if (value === "0300") { return "UPDATE Message Error - Unspecific" } if (value === "0301") { return "UPDATE Message Error - Malformed Attribute List" } if (value === "0302") { return "UPDATE Message Error - Unrecognized Well-known Attibute" } if (value === "0303") { return "UPDATE Message Error - Missing Well-know Attribute" } if (value === "0304") { return "UPDATE Message Error - Attribute Flags Error" } if (value === "0305") { return "UPDATE Message Error - Attribute Length Error" } if (value === "0306") { return "UPDATE Message Error - Invalid ORIGIN Attribute" } if (value === "0307") { return "UPDATE Message Error - [Deprecated]" } if (value === "0308") { return "UPDATE Message Error - Invalid NEXT_HOP Attribute" } if (value === "0309") { return "UPDATE Message Error - Optional Attribute Error" } if (value === "0310") { return "UPDATE Message Error - Invalid Network Field" } if (value === "0311") { return "UPDATE Message Error - Malformed AS_PATH" } if (value === "0400") { return "Hold Timer Expired" } if (value === "0500") { return "Finite State Machine Error - Unspecified Error" } if (value === "0501") { return "Finite State Machine Error - Receive Unexpected Message in OpenSent State" } if (value === "0502") { return "Finite State Machine Error - Receive Unexpected Message in OpenConfirm State" } if (value === "0503") { return "Finite State Machine Error - Receive Unexpected Message in Established State" } if (value === "0600") { return "Cease NOTIFICATION - Reserved" } if (value === "0601") { return "Cease NOTIFICATION - Maximum Number of Prefixes Reached" } if (value === "0602") { return "Cease NOTIFICATION - Administrative Shutdown" } if (value === "0603") { return "Cease NOTIFICATION - Peer De-configured" } if (value === "0604") { return "Cease NOTIFICATION - Administrative Reset" } if (value === "0605") { return "Cease NOTIFICATION - Connection Rejected" } if (value === "0606") { return "Cease NOTIFICATION - Other Configuration Change" } if (value === "0607") { return "Cease NOTIFICATION - Connection Collision Resolution" } if (value === "0608") { return "Cease NOTIFICATION - Out of Resources" } if (value === "0609") { return "Cease NOTIFICATION - Hard Reset" } if (value === "0700") { return "ROUTE-REFRESH Message Error - Reserded" } if (value === "0701") { return "ROUTE-REFRESH Message Error - Invalid Message Length" } return value tags: - tag: Application value: BGPv4 - tag: Application value: 'BGPv4 {#SNMPVALUE}' - uuid: 32ffca92bd1644e1b99ba8f8b6b2cf65 name: 'Remote AS for peer $1' type: SNMP_AGENT snmp_oid: '1.3.6.1.2.1.15.3.1.9.{#SNMPVALUE}' key: 'bgpPeerRemoteAs[{#SNMPVALUE}]' delay: 1d history: 7d trends: '0' tags: - tag: Application value: BGPv4 - tag: Application value: 'BGPv4 {#SNMPVALUE}' - uuid: af084bc48aed4b189ef4c8a5caf21405 name: 'Operational status for peer $1' type: SNMP_AGENT snmp_oid: '1.3.6.1.2.1.15.3.1.2.{#SNMPVALUE}' key: 'bgpPeerState[{#SNMPVALUE}]' history: 30d trends: '0' valuemap: name: 'BGP4-MIB::bgpPeerState' tags: - tag: Application value: BGPv4 - tag: Application value: 'BGPv4 {#SNMPVALUE}' trigger_prototypes: - uuid: 454e93c4d273469ba4e9baac37a5ff5e expression: 'last(/BGPv4 SNMP/bgpPeerState[{#SNMPVALUE}],#3)<>6 and last(/BGPv4 SNMP/bgpPeerAdminStatus[{#SNMPVALUE}])=2' name: 'BGP peer {#SNMPVALUE} ASN {#SNMPASN} is DOWN' priority: HIGH description: 'Trigger for peer that has a remote AS matching {$BGP_PEER_AS} macro.' macros: - macro: '{$PEER_LOW_TIME}' value: '14400' description: 'time in sec alarm for low uptime bgp session' valuemaps: - uuid: f94f32d1110545879431b948674e0be4 name: 'BGP4-MIB::bgpPeerAdminStatus' mappings: - value: '1' newvalue: stoped - value: '2' newvalue: started - uuid: 292fe22b2d484c27a5fe38ff1f95cfa5 name: 'BGP4-MIB::bgpPeerState' mappings: - value: '1' newvalue: idle - value: '2' newvalue: connect - value: '3' newvalue: active - value: '4' newvalue: opensent - value: '5' newvalue: openconfirm - value: '6' newvalue: established