...
/var/local/healthbot/rules | ||||||
---|---|---|---|---|---|---|
telemetry sensor interface-status.rule file | topic interface.statistics Code Block | | ||||
|
Code Block | ||
---|---|---|
| ||
jcluser@ubuntu:/var/local/healthbot/rules/juniper_official/Interfaces$ more interface-status.rule /* * Monitors interface link state and notifies when anomalies are found. * One input control detection * * 1) interface-name-variable, is a regular expression that matches the * interfaces that you would like to monitor. By default it's * '.*', which matches all interfaces. Use something like 'ge.*' to * match only gigabit ethernet interfaces. * */ iceberg { topic interface.statistics { description "Monitors and notify interface statistics i.e. link state, flaps, neighbor state, input & output traffic and errors"; synopsis "Interface statistics *analyzer"; dashboard colors when the *all* link oper state {{link-state}} rule check-interface-status { *synopsis is"Tnterface down (red). Otherwise the color is set to green.state analyzer"; description "Collects interface link oper state periodically and *notifies when neighbor sate is down"; * Use interface name as/* key for rule. * Monitors the */interface link oper state. Notifies via the keys interface-name; * dashboard colors when the *all* /*link oper state {{link-state}} * Sensor configuration to get data from network devicesis down (red). Otherwise the color is set to green. */ sensor interfaces* {Use interface name as key for rule. synopsis "Interface open-config sensor*/ definition"; keys interface-name; description "Interfaces open-config sensor to collect telemetry data from network device"; /* * Sensor configuration to get data open-config {from network devices. */ sensor-name /interfaces/; { synopsis "Interface open-config frequencysensor 60sdefinition"; }description "Interfaces open-config sensor to collect telemetry data from network device"; } /* open-config { * Fields defined using sensor path. Map the longer sensor names-name /interfaces/; * to the shorter field names used infrequency the60s; rules. */ } field admin-state {} /* sensor interfaces { * Fields defined using sensor path. Map the longer sensor names path /interfaces/interface/state/admin-status; * to the shorter field names used }in the rules. */ type string; field admin-state { description "Interface admin status"; sensor interfaces { } field interface-name { path /interfaces/interface/state/admin-status; sensor interfaces { } where "/interfaces/interface/@name =~ /{{interface-name-variable}}/"type string; description "Interface path "/interfaces/interface/@nameadmin status"; } } field interface-name { type string; sensor interfaces { description "Interfaces to be monitored"; where "/interfaces/interface/@name =~ /{{interface-name-variable}}/"; field link-state { path "/interfaces/interface/@name"; sensor interfaces { } path /interfaces/interface/state/oper-statustype string; }description "Interfaces to be monitored"; type} string; field link-state { description "Interfaces link operator status"; sensor interfaces { } /* path /interfaces/interface/state/oper-status; * Anomaly detection logic. } */ type triggerstring; link-state { description "Interfaces synopsis "link stateoperator kpistatus"; } description "Sets health based on link state"; /* /* Anomaly detection logic. */ Skips evaluation for admin down state interfaces trigger link-state { */ synopsis "link state kpi"; frequency 60s; description "Sets health based term is-link-admin-down {on link state"; /* when { * Skips evaluation for admin down state interfaces matches-with "$admin-state" DOWN; */ } frequency 60s; } term is-link-admin-down { /* when { * Sets color to red and sends out anomaly notification when matches-with "$admin-state" DOWN; * the interface oper state ($link-state) is down. } */ } term is-link-down { /* when { * Sets color to red and sends out anomaly notification when matches-with "$admin-state" UP; * the interface oper state ($link-state) is down. matches-with "$link-state" DOWN; */ term is-link-down }{ thenwhen { status {matches-with "$admin-state" UP; matches-with "$link-state" DOWN; color red; } message "$interface-name link operator status is DOWN"; then { status { color red; message "$interface-name link operator status is DOWN"; } } } /* * Defaults color to green. */ term link-up { then { status { color green; message "$interface-name link operator status is UP"; } } } } /* * Variables with default values. Default values can be changed * while deploying playbook instance. */ variable interface-name-variable { value ".*"; description "Interface names to monitor, regular expression, e.g. 'ge-.*'"; type string; } rule-properties { version 2; contributor juniper; supported-healthbot-version 1.0.1; catalogue { tier 1; } supported-devices { juniper { operating-system junos { products MX { releases 16.1R1 { release-support min-supported-release; platform [ MX240 MX480 MX960 MX2010 MX2020 ]; } releases 17.3R1 { release-support min-supported-release; platform MX150; } } products PTX { releases 17.2R1 { release-support min-supported-release; platform [ PTX5000 PTX1000 PTX10000 ]; } } products QFX { releases 17.2R1 { release-support min-supported-release; platform [ QFX10000 QFX5200 ]; } releases 18.1R1 { release-support min-supported-release; platform QFX5100; } releases 18.3R1 { release-support min-supported-release; platform QFX5120-48Y; } } products EX { releases 17.3R1 { release-support min-supported-release; platform EX9200; } releases 18.3R1 { release-support min-supported-release; platform EX4650; } releases 18.4R1 { release-support min-supported-release; platform EX4600; } } } } other-vendor cisco-IOS-XR { vendor-name cisco; operating-system IOS-XR; } } } } } } |
topic interface.statistics
rule snmp-check-interface-flaps
sensor interfaces
snmp
fields flaps
fields index
rule-properties
juniper
operation-system junos
. . . .
Code Block | ||
---|---|---|
| ||
iceberg { topic interface.statistics { rule snmp-check-interface-flaps { } description "Collects link flap count periodically"; } synopsis "Interface flaps analyzer"; }keys index; /* * DefaultsCollects color to green. the link flap count on an interface */ * for every collected metric during a 60s time range (red). term link-up { * Use snmp index of interface as key for rule. then { */ sensor statusinterfaces { synopsis "Interface snmp sensor definition"; color green; description "Interfaces snmp sensor to collect data from network device"; message "$interface-name link operator status is UP"; snmp { table JUNIPER-IF-MIB::ifJnxTable; } frequency 290s; } } } /* } * Fields defined using sensor path. Map /*the longer sensor names * Variables with default* values.to Defaultthe valuesshorter canfield benames changedused in the rules. * while deploying playbook instance.*/ field flaps */{ variable interface-name-variable { sensor interfaces { value ".*"; path ifJnxCarrierTrans; description "Interface names to monitor, regular expression, e.g. 'ge-.*'"; } type stringinteger; } description "Number of interface flaps"; rule-properties { } version 2; field index { contributor juniper; sensor interfaces { supported-healthbot-version 1.0.1; path index; catalogue { } tier 1; type string; } rule-properties { supported-devices { version 2; juniper { contributor juniper; operatingsupported-healthbot-system junos {version 1.0.1; supported-devices { products MX { juniper { releases 16.1R1operating-system junos { products EX { release-support min-supported-release; releases 17.3R1 { platform [ MX240 MX480 MX960 MX2010 MX2020 ]; release-support min-supported-release; } platform EX9200; releases 17.3R1 { } release-support min-supported-release; releases 18.3R1 { platform MX150; release-support min-supported-release; } platform EX4650; } products PTX {} releases 1718.2R14R1 { release-support min-supported-release; platform [ PTX5000 PTX1000 PTX10000 ]EX4600; } } products QFXMX { releases 1714.2R11R1 { release-support min-supported-release; platform [ QFX10000 QFX5200MX2010 MX2020 MX240 MX480 MX960 ]; } releases 1817.1R13R1 { release-support min-supported-release; platform QFX5100MX150; } } releases 18.3R1 { products PTX { release-support min-supported-release; releases 17.2R1 { platform QFX5120-48Y; } release-support min-supported-release; } platform [ PTX1000 PTX10000 PTX5000 ]; products EX { } releases 17.3R1 { } release-support min-supported-release; products QFX { platform EX9200; releases 17.2R1 { } release-support min-supported-release; releases 18.3R1 { platform [ QFX10000 QFX5200 ]; release-support min-supported-release; } platform EX4650; releases 18.1R1 { } release-support min-supported-release; releases 18.4R1 { platform QFX5100; release-support min-supported-release; } platform EX4600; releases 18.3R1 { } release-support min-supported-release; } } platform QFX5120-48Y; } other-vendor cisco-IOS-XR {} vendor-name cisco; } operating-system IOS-XR; } } } } } } } |