-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathcheck-routing-engine-temperature.rule
More file actions
452 lines (452 loc) · 20.1 KB
/
check-routing-engine-temperature.rule
File metadata and controls
452 lines (452 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
/*
* Monitors routing-engine temperature and notifies when anomalies are found.
*
* Three inputs control detection
*
* 1) "re-slot-no" is a regular expression that matches the routing engine
* that you would like to monitor. By default it's '0-1', which matches
* both the routing engines. Use something like '0' to match only
* routing engine 0.
*
* 2) "re-temperature-low-threshold" is the threshold that causes the
* rule to report an anomaly. By default it's 45 degree Celcius of
* RE temperature. This rule will set a dashboard color to green
* when temperature is below low threshold.
*
* 3) "re-temperature-high-threshold" is the threshold that causes the
* rule to report an anomaly. By default it's 55 degree Celcius of RE
* temperature.
*
* Requirement 14 (https://paragon-automation.atlassian.net/browse/REQ-14)
*
*/
healthbot {
topic hardware.chassis {
rule check-routing-engine-temperature {
/*
* Monitors the routing-engine temperature and notifies via dashboard, red color
* when threshold is exceeded else green.
*
* Use routing-engine as key for rule.
*/
keys routing-engine;
synopsis "Routing engine temperature";
description "Collects system RE Temperature statistics periodically and notifies anomalies";
/*
* Sensor configuration to get data from network devices.
*/
sensor components-oc {
synopsis "routing-engine temperature KPI";
description "open-config sensor to collect telemetry data from network device";
open-config {
sensor-name /components/component;
frequency 60s;
}
}
sensor components-oc-junos {
open-config {
sensor-name /components/component;
frequency 60s;
}
}
/*
* Fields defined using sensor path. Map the longer sensor names
* to the shorter field names used in the rules.
*/
field routing-engine-cpu-temperature {
sensor components-oc {
where "/components/component/properties/property/@name == 'CPU Temperature'";
path /components/component/properties/property/state/value;
}
sensor components-oc-junos {
where "/components/component/properties/property/@name == 'temperature-cpu'";
path /components/component/properties/property/state/value;
}
type integer;
description "CPU temperature";
plots re-cpu-temperature-plots {
unit celsius;
triggers routing-engine-cpu-temperature;
thresholds high-threshold {
field-name "$high-threshold";
severity critical;
}
thresholds low-threshold {
field-name "$low-threshold";
severity minor;
}
thresholds routing-engine-cpu-temperature-anomaly {
field-name "$routing-engine-cpu-temperature-anomaly";
severity minor;
type jaiml-threshold;
}
}
}
field routing-engine-temperature {
sensor components-oc {
where "/components/component/properties/property/@name == 'temperature'";
path /components/component/properties/property/state/value;
}
sensor components-oc-junos {
where "/components/component/properties/property/@name == 'temperature'";
path /components/component/properties/property/state/value;
}
type integer;
description "RE temperature";
plots re-temperature-plots {
unit celsius;
triggers routing-engine-temperature;
thresholds high-threshold {
field-name "$high-threshold";
severity critical;
}
thresholds low-threshold {
field-name "$low-threshold";
severity minor;
}
thresholds routing-engine-temperature-anomaly {
field-name "$routing-engine-temperature-anomaly";
severity minor;
type jaiml-threshold;
}
}
}
field routing-engine {
sensor components-oc {
where "/components/component/@name =~ /^Routing Engine[{{re-slot-no}}]$|^RE[{{re-slot-no}}]$|^CHASSIS[{{re-slot-no}}]:RE[{{re-slot-no}}]$/";
path "/components/component/@name";
}
sensor components-oc-junos {
where "/components/component/@name =~ /^Routing Engine[{{re-slot-no}}]$|^RE[{{re-slot-no}}]$|^CHASSIS[{{re-slot-no}}]:RE[{{re-slot-no}}]$/";
path "/components/component/@name";
}
description "RE name to monitor";
}
field high-threshold {
constant {
value "{{re-temperature-high-threshold}}";
}
type integer;
description "RE temperature high threshold";
}
field low-threshold {
constant {
value "{{re-temperature-low-threshold}}";
}
type integer;
description "RE temperature low threshold";
}
field routing-engine-cpu-temperature-anomaly {
formula {
jaiml-anomaly-detection {
field-name "$routing-engine-cpu-temperature";
}
}
type integer;
description "JAIML anomaly detection on routing engine CPU temperature field";
}
field routing-engine-temperature-anomaly {
formula {
jaiml-anomaly-detection {
field-name "$routing-engine-temperature";
}
}
type integer;
description "JAIML anomaly detection on routing engine temperature field";
}
/*
* Anomaly detection logic.
*/
trigger routing-engine-temperature {
alert-type hardware.temperature.routing_engine.routing-engine-temperature;
synopsis "RE temperature KPI";
description "Sets health based increase in RE temperature";
frequency 1offset;
/*
* Sets color to green when RE temperature
* re-temperature is below low threshold ($low-threshold).
*/
term is-re-temperature-normal {
when {
less-than "$routing-engine-temperature" "$low-threshold";
less-than-or-equal-to "$routing-engine-temperature-anomaly" 0;
}
then {
status {
color green;
message "$routing-engine temperature($routing-engine-temperature degree C) is normal";
}
}
}
/*
* Sets color to yellow when RE temperature re-temperature is below low threshold ($low-threshold)
* and the temperature value is anomalous.
*/
term is-re-temperature-anomalous {
when {
less-than "$routing-engine-temperature" "$low-threshold";
equal-to "$routing-engine-temperature-anomaly" 1;
}
then {
status {
color yellow;
message "$routing-engine temperature is anomalous";
}
}
}
/*
* Sets color to green when RE temperature is below low threshold ($low-threshold)
*
*/
term is-temperature-less-than-low-threshold {
when {
less-than "$routing-engine-temperature" "$low-threshold";
}
then {
status {
color green;
message "$routing-engine temperature($routing-engine-temperature degree celsius) is normal";
}
}
}
/*
* Sets color to yellow and notify anomaly when RE temperature
* ($routing-engine-temperature) is below high threshold ($high-threshold)
*/
term is-re-temperature-median {
when {
greater-than-or-equal-to "$routing-engine-temperature" "$low-threshold";
less-than "$routing-engine-temperature" "$high-threshold";
}
then {
status {
color yellow;
message "$routing-engine temperature($routing-engine-temperature degree C) is-equal-to or exceeds high threshold";
}
}
}
/*
* Defaults color to red and notify anomaly.
*/
term re-temperature-abnormal {
when {
greater-than-or-equal-to "$routing-engine-temperature" "$high-threshold";
}
then {
status {
color red;
message "$routing-engine temperature($routing-engine-temperature degree C) is-equal-to or exceeds critical threshold";
}
}
}
}
trigger routing-engine-cpu-temperature {
alert-type hardware.temperature.routing_engine.cpu.routing-engine-cpu-temperature;
synopsis "RE CPU temperature KPI";
description "Sets health based increase in RE CPU temperature";
frequency 1offset;
/*
* Sets color to green when RE CPU temperature
* re-cpu-temperature is below low threshold ($low-threshold).
*/
term is-temperature-normal {
when {
less-than "$routing-engine-cpu-temperature" "$low-threshold";
less-than-or-equal-to "$routing-engine-cpu-temperature-anomaly" 0;
}
then {
status {
color green;
message "$routing-engine CPU temperature($routing-engine-cpu-temperature degree C) is normal";
}
}
}
/*
* Sets color to yellow when RE temperature re-temperature is below low threshold ($low-threshold)
* and the temperature value is anomalous.
*/
term is-re-cpu-temperature-anomalous {
when {
less-than "$routing-engine-cpu-temperature" "$low-threshold";
equal-to "$routing-engine-cpu-temperature-anomaly" 1;
}
then {
status {
color yellow;
message "$routing-engine CPU temperature is anomalous";
}
}
}
/*
* Sets color to green when RE CPU temperature is below low threshold ($low-threshold)
*
*/
term is-temperature-less-than-low-threshold {
when {
less-than "$routing-engine-cpu-temperature" "$low-threshold";
}
then {
status {
color green;
message "$routing-engine CPU temperature($routing-engine-cpu-temperature degree celsius) is normal";
}
}
}
/*
* Sets color to yellow and notify anomaly when RE CPU
* temperature ($routing-engine-cpu-temperature) is below high threshold
* ($high-threshold).
*/
term is-temperature-median {
when {
greater-than-or-equal-to "$routing-engine-cpu-temperature" "$low-threshold";
less-than "$routing-engine-cpu-temperature" "$high-threshold";
}
then {
status {
color yellow;
message "$routing-engine CPU temperature($routing-engine-cpu-temperature degree C) is-equal-to or exceeds high threshold";
}
}
}
/*
* Defaults color to red and notify anomaly.
*/
term temperature-abnormal {
when {
greater-than-or-equal-to "$routing-engine-cpu-temperature" "$high-threshold";
}
then {
status {
color red;
message "$routing-engine CPU temperature($routing-engine-cpu-temperature degree C) is-equal-to or exceeds critical threshold";
}
}
}
}
/*
* Variables with default values. Default values can be changed
* while deploying playbook instance.
*/
variable re-slot-no {
value 0-1;
description "Routing engine numbers to monitor, regular expression, e.g. '0'";
type string;
}
variable re-temperature-high-threshold {
value 55;
description "RE temperature high threshold: Utilization increase between metrics, before we report anomaly";
type int;
}
variable re-temperature-low-threshold {
value 45;
description "RE temperature low threshold: Utilization increase between metrics, before we report anomaly";
type int;
}
rule-properties {
version 1;
domain-name chassis;
contributor juniper;
category advanced;
supported-healthbot-version 4.2.0;
supported-devices {
sensors components-oc;
juniper {
operating-system junosEvolved {
products ACX {
sensors components-oc;
platforms All {
releases 22.3R1 {
release-support min-supported-release;
}
}
}
products PTX {
sensors components-oc-junos;
platforms PTX10008 {
releases 22.2R3 {
release-support min-supported-release;
}
}
}
}
operating-system junos {
products MX {
sensors components-oc-junos;
platforms MX204 {
releases 22.2R3 {
release-support min-supported-release;
}
}
platforms MX304 {
releases 22.2R3 {
release-support min-supported-release;
}
}
platforms MX480 {
releases 23.2R1 {
release-support min-supported-release;
}
}
platforms MX960 {
releases 23.2R1 {
release-support min-supported-release;
}
}
platforms MX10004 {
releases 22.3R1 {
release-support min-supported-release;
}
}
platforms MX10008 {
releases 22.3R1 {
release-support min-supported-release;
}
}
platforms MX10016 {
releases 22.3R1 {
release-support min-supported-release;
}
}
}
products JNP {
sensors components-oc-junos;
platforms JNP10004 {
releases 22.3R1 {
release-support min-supported-release;
}
}
platforms JNP10008 {
releases 22.3R1 {
release-support min-supported-release;
}
}
platforms JNP10016 {
releases 22.3R1 {
release-support min-supported-release;
}
}
}
products EX {
sensors components-oc-junos;
platforms EX4300-48MP {
releases 22.4R2.8 {
release-support min-supported-release;
}
}
}
products QFX {
sensors components-oc-junos;
platforms QFX5110-48S {
releases 22.3R1 {
release-support min-supported-release;
}
}
}
}
}
}
}
}
}
}