/* * Detects chassis temperature threshold breaches and notifies when anomalies * are found. * Two inputs control detection * * 1) "chassis-temperature-low-threshold" is the threshold that causes the * rule to report an anomaly. By default it's 45 degree Cecilius of * chassis temperature. This rule will set a dashboard color to green * when temperature is below low threshold. * * 2) "chassis-temperature-high-threshold" is the threshold that causes the * rule to report an anomaly. By default it's 55 degree Cecilius of * chassis temperature. This rule will set a dashboard color to yellow * when temperature is below high threshold. Otherwise color is set to * red and notify anomaly. */ healthbot { topic chassis.temperatures { description "Monitors the chassis temperatures of whole chassis, REs', FPCs' & RE CPUs and notifies anomalies"; synopsis "Chassis environment analyzer"; rule check-chassis-temperature { synopsis "Chassis temperature check"; description "Collects chassis temperature periodically and notifies anomalies when temperature exceed threshold"; /* * Monitors chassis temperature. Notifies via the dashboard * colors when the when chassis temperature is below low threshold * {{chassis-temperature-low-threshold}} to green. The color is * set to yellow if we see temperature is below high threshold * {{chassis-temperature-high-threshold}}. Otherwise the color is * set to red and notify anomaly. * * Use chassis name as key for rule. */ keys chassis-name; /* * Sensor configuration to get data from network devices */ sensor components { synopsis "Chassis components sensor definition"; description "/components open-config sensor to collect telemetry data from network device"; open-config { sensor-name /components/; frequency 60s; } } /* * Fields defined using sensor path. Map the longer sensor names * to the shorter field names used in the rules. */ field chassis-name { sensor components { where "/components/component/@name =~ /Chassis/"; path "/components/component/@name"; } type string; description "chassis name to monitor"; } field temperature-ambient { sensor components { where "/components/component/properties/property/@name == 'temperature-ambient'"; path /components/component/properties/property/state/value; zero-suppression; } type integer; description "Chassis temperature"; } /* * Fields defined with variables and constant values */ field high-threshold { constant { value "{{chassis-temperature-high-threshold}}"; } type integer; description "Chassis ambient temperature high threshold"; } field low-threshold { constant { value "{{chassis-temperature-low-threshold}}"; } type integer; description "Chassis ambient temperature low threshold"; } /* * Anomaly detection logic. */ trigger chassis-ambient-temperature { synopsis "Chassis temperature KPI"; description "Sets health based on increase in chassis temperature"; frequency 1offset; /* * Sets color to green when temperature ($temperature-ambient) * is below low threshold ($low-threshold). */ term is-temperature-normal { when { less-than "$temperature-ambient" "$low-threshold"; } then { status { color green; message "Chassis ambient temperature is normal"; } } } /* * Sets color to yellow and notify anomaly when chassis * temperature ($temperature-ambient) is below high threshold * ($high-threshold). */ term is-temperature-median { when { less-than "$temperature-ambient" "$high-threshold"; } then { status { color yellow; message "Chassis ambient temperature($temperature-ambient degree C) exceed low threshold"; } } } /* * Defaults color to red and notify anomaly. */ term temperature-abnormal { then { status { color red; message "Chassis ambient temperature($temperature-ambient degree C) exceed high threshold"; } } } } /* * Variables with default values. Default values can be changed * while deploying playbook instance. */ variable chassis-temperature-high-threshold { value 55; description "Chassis temperature high threshold: Utilization increase between metrics, before we report anomaly"; type int; } variable chassis-temperature-low-threshold { value 45; description "Chassis temperature low threshold: Utilization increase between metrics, before we report anomaly"; type int; } rule-properties { version 2; contributor juniper; category basic; supported-healthbot-version 1.0.1; supported-devices { juniper { operating-system junos { products MX { platforms MX240 { releases 16.1R1 { release-support min-supported-release; } } platforms MX480 { releases 16.1R1 { release-support min-supported-release; } } platforms MX960 { releases 16.1R1 { release-support min-supported-release; } } platforms MX2010 { releases 16.1R1 { release-support min-supported-release; } } platforms MX2020 { releases 16.1R1 { release-support min-supported-release; } } platforms MX150 { releases 17.3R1 { release-support min-supported-release; } } } products PTX { platforms PTX5000 { releases 17.2R1 { release-support min-supported-release; } } platforms PTX1000 { releases 17.2R1 { release-support min-supported-release; } } platforms PTX10000 { releases 17.2R1 { release-support min-supported-release; } } } products QFX { platforms QFX10000 { releases 17.2R1 { release-support min-supported-release; } } platforms QFX5200 { releases 17.2R1 { release-support min-supported-release; } } platforms QFX5100 { releases 18.1R1 { release-support min-supported-release; } } platforms QFX5120-48Y { releases 18.3R1 { release-support min-supported-release; } } } products EX { platforms EX9200 { releases 17.3R1 { release-support min-supported-release; } } platforms EX4650 { releases 18.3R1 { release-support min-supported-release; } } platforms EX4600 { releases 18.4R1 { release-support min-supported-release; } } } } } } } } } }