diff --git a/juniper_official/routing/Ospf3NeighborStatsTable.yml b/juniper_official/routing/Ospf3NeighborStatsTable.yml index ccdc9458..c653953d 100644 --- a/juniper_official/routing/Ospf3NeighborStatsTable.yml +++ b/juniper_official/routing/Ospf3NeighborStatsTable.yml @@ -16,6 +16,30 @@ Ospf3NeighborStatsView: ospf-neighbor-state: ospf-neighbor-state instance-name: ../../ospf-instance-name +Ospf3StatsTable: + rpc: get-ospf3-statistics-information + item: ospf-statistics/packet-statistics[ospf-packet-type="Hello"] + key: ospf-packet-type + view: Ospf3StatsView + +Ospf3StatsView: + fields: + hello-sent: packets-sent + hello-received: packets-received + hello-sent-5sec: packets-sent-5seconds + hello-received-5sec: packets-received-5seconds + +Ospf3IoStatsTable: + rpc: get-ospf3-io-statistics-information + item: ospf-io-statistics + key: Null + view: ospf3ioview + +ospf3ioview: + fields: + packets-read: packets-read + ospf-error: ospf-errors/* + xslt: " diff --git a/juniper_official/routing/check-ospf3-io-statistics.rule b/juniper_official/routing/check-ospf3-io-statistics.rule new file mode 100644 index 00000000..c77d25f9 --- /dev/null +++ b/juniper_official/routing/check-ospf3-io-statistics.rule @@ -0,0 +1,160 @@ +/* + * Detects Osp3fIoStatsTable IO errors and notifies when anomalies are found. + */ + healthbot { + topic routing.ospf { + rule check-ospf3-io-statistics { + synopsis "OSPF3 IO statistics analyzer"; + description "Monitors OSPF's I/O statistics"; + sensor ospf-io-statistics-netconf { + synopsis "OSPF netconf sensor definition"; + iAgent { + file Ospf3NeighborStatsTable.yml; + table Osp3fIoStatsTable; + frequency 180s; + } + } + field ospf-error { + sensor ospf-io-statistics-netconf { + path ospf-error; + data-if-missing { + value 0; + } + } + type integer; + description "Ospf IO error count"; + } + field packets-read { + sensor ospf-io-statistics-netconf { + path packets-read; + } + type integer; + description "Ospf IO packet read count"; + } + field error-threshold { + constant { + value "{{error-threshold}}"; + } + type integer; + description "Packet error threshold"; + } + /* + * Anomaly detection logic. + */ + trigger ospf-io-errors { + alert-type routing.ospf.errors.io.ospf-io-errors; + synopsis "ospf io statistics kpi"; + description "Sets health based on ospf io errors"; + frequency 1offset; + /* + * Sets color to green when ospf errors is not incrementing. + */ + term no-ospf-error-reported { + when { + matches-with-previous "$ospf-error" { + time-range 2.5offset; + latest; + } + } + then { + status { + color green; + message "OSPF IO error ($ospf-error)is not increasing"; + } + } + } + /* + * Sets color to red and sends out an anomaly notification + * when the ospf error count increases by 1. + */ + term is-ospf-error-increasing { + when { + increasing-at-least-by-value "$ospf-error" { + value "$error-threshold"; + time-range 2.5offset; + latest; + } + } + then { + status { + color red; + message "OSPF IO is reporting errors($ospf-error)"; + } + } + } + } + variable error-threshold { + value 1; + type int; + description "Packet error threshold: Increase between metrics, before we report anomaly"; + } + rule-properties { + version 2; + contributor juniper; + category basic; + supported-healthbot-version 1.0.1; + supported-devices { + juniper { + sensors ospf-io-statistics-netconf; + operating-system junos { + products ACX { + platforms All { + releases 15.2R1 { + release-support min-supported-release; + } + } + } + products EX { + platforms All { + releases 15.2R1 { + release-support min-supported-release; + } + } + } + products MX { + platforms All { + releases 11.4R1 { + release-support min-supported-release; + } + } + } + products PTX { + platforms All { + releases 11.4R1 { + release-support min-supported-release; + } + } + } + products VMX { + platforms VMX { + releases 23.2R1 { + release-support min-supported-release; + } + } + } + } + operating-system junosEvolved { + products ACX { + platforms All { + releases 22.3R1 { + release-support min-supported-release; + } + } + } + products PTX { + platforms PTX10008 { + releases 22.2R3 { + release-support min-supported-release; + } + } + } + } + } + } + helper-files other { + list-of-files Ospf3NeighborStatsTable.yml; + } + } + } + } +} \ No newline at end of file diff --git a/juniper_official/routing/check-ospf3-statistics.rule b/juniper_official/routing/check-ospf3-statistics.rule new file mode 100644 index 00000000..0e7ff8d2 --- /dev/null +++ b/juniper_official/routing/check-ospf3-statistics.rule @@ -0,0 +1,191 @@ +/* + * Monitors OSPF3 hello packets and notifies anomalies when hello send and receive count + * is not increasing. + */ + healthbot { + topic routing.ospf { + rule check-ospf3-statistics { + keys ospf-packet-type; + synopsis "ospf hello statistics analyzer"; + description "Monitors the transmission and reception of hello packets"; + sensor ospf-statistics-netconf { + synopsis "OSPF iAgent sensor definition"; + description "Netconfig rpc get-ospf-neighbor-information iAgent sensor to collect telemetry data from network device"; + iAgent { + file Ospf3NeighborStatsTable.yml; + table Ospf3StatsTable; + frequency 180s; + } + } + field hello-received { + sensor ospf-statistics-netconf { + path hello-received; + } + type integer; + description "Ospf hello packets received"; + } + field hello-sent { + sensor ospf-statistics-netconf { + path hello-sent; + } + type integer; + description "Ospf hello packets sent"; + } + field ospf-packet-type { + sensor ospf-statistics-netconf { + path ospf-packet-type; + } + type string; + description "Packet type"; + } + field hello-count-threshold { + constant { + value "{{hello-count-threshold}}"; + } + type integer; + description "Hello count threshold"; + } + trigger ospf-hello-received { + alert-type routing.ospf.hello.received.ospf-hello-received; + synopsis "ospf hello received statistics kpi"; + description "Sets health based on ospf hello received statistics"; + frequency 1offset; + term is-ospf-hello-receive-increasing { + when { + increasing-at-least-by-value "$hello-received" { + value "$hello-count-threshold"; + time-range 2.5offset; + latest; + } + } + then { + status { + color green; + message "OSPF receive module is functioning, hello receive count($hello-received) is increasing"; + } + } + } + term is-ospf-hello-receive-not-increasing { + when { + matches-with-previous "$hello-received"{ + time-range 2.5offset; + latest; + } + } + then { + status { + color red; + message "OSPF receive module not functioning, hello receive count($hello-received) is not increasing"; + } + } + } + } + trigger ospf-hello-sent { + alert-type routing.ospf.hello.sent.ospf-hello-sent; + synopsis "ospf hello sent statistics kpi"; + description "Sets health based on ospf hello sent statistics"; + frequency 1offset; + term is-ospf-hello-sent-increasing { + when { + increasing-at-least-by-value "$hello-sent" { + value "$hello-count-threshold"; + time-range 2.5offset; + latest; + } + } + then { + status { + color green; + message "OSPF send module is functioning, hello send count($hello-sent) is increasing"; + } + } + } + term is-ospf-hello-sent-not-increasing { + when { + matches-with-previous "$hello-sent"{ + time-range 2.5offset; + latest; + } + } + then { + status { + color red; + message "OSPF send module not functioning, hello send count($hello-sent) is not increasing"; + } + } + } + } + variable hello-count-threshold { + value 1; + type int; + description "Increase between metrics, before we report anomaly"; + } + rule-properties { + version 2; + contributor juniper; + category basic; + supported-healthbot-version 1.0.1; + supported-devices { + juniper { + operating-system junos { + products ACX { + platforms All { + releases 15.2R1 { + release-support min-supported-release; + } + } + } + products EX { + platforms All { + releases 15.2R1 { + release-support min-supported-release; + } + } + } + products MX { + platforms All { + releases 11.4R1 { + release-support min-supported-release; + } + } + } + products PTX { + platforms All { + releases 11.4R1 { + release-support min-supported-release; + } + } + } + products VMX { + platforms VMX { + releases 23.2R1 { + release-support min-supported-release; + } + } + } + } + operating-system junosEvolved { + products ACX { + platforms All { + releases 22.3R1 { + release-support min-supported-release; + } + } + } + products PTX { + platforms PTX10008 { + releases 22.2R3 { + release-support min-supported-release; + } + } + } + } + } + } + helper-files other { + list-of-files Ospf3NeighborStatsTable.yml; + } + } + } + } +} \ No newline at end of file