-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathTemplate smartmonitor.xml
592 lines (592 loc) · 32.5 KB
/
Template smartmonitor.xml
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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-09-23T09:16:55Z</date>
<groups>
<group>
<name>Templates Users</name>
</group>
</groups>
<templates>
<template>
<template>Template SMARTMONTOOLS</template>
<name>Template SMARTMONTOOLS</name>
<description>#
# .VERSION
# 0.8
#
# .DESCRIPTION
# Author: Nikitin Maksim
# Github: https://github.com/nikimaxim/zbx-smartmonitor.git
# Note: Zabbix lld for smartctl
#
# .TESTING
# Smartmontools: 7.1 and later
#</description>
<groups>
<group>
<name>Templates Users</name>
</group>
</groups>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<items>
<item>
<name>Smartctl version</name>
<key>smartctl.version</key>
<delay>1h</delay>
<trends>0</trends>
<value_type>CHAR</value_type>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<triggers>
<trigger>
<expression>{diff()}=1</expression>
<name>Version of smartctl was changed on {HOST.NAME}</name>
<priority>INFO</priority>
</trigger>
</triggers>
</item>
</items>
<discovery_rules>
<discovery_rule>
<name>Smartctl storage discovery</name>
<key>storage.discovery</key>
<delay>12h</delay>
<filter>
<conditions>
<condition>
<macro>{#STORAGE.SMART}</macro>
<value>1</value>
<formulaid>A</formulaid>
</condition>
</conditions>
</filter>
<item_prototypes>
<item_prototype>
<name>{#STORAGE.NAME}: Error сount</name>
<type>DEPENDENT</type>
<key>storage.error["{#STORAGE.CMD}"]</key>
<delay>0</delay>
<trends>0</trends>
<value_type>CHAR</value_type>
<description>HDD
SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>if (value.search("No Errors Logged") != -1) {
return "No Errors Logged"
} else if (value.search("ATA Error Count:") != -1) {
return value.match(/(?:ATA Error Count:).+\b([0-9]+)/i)[1]
} else {
return "Not supported"
}
</params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{str(No Errors Logged)}=0 and {str(Not supported)}=0</expression>
<name>{#STORAGE.NAME}: SMART error status is not "No Errors Logged"</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: Smartctl</name>
<key>storage.get["{#STORAGE.CMD}"]</key>
<delay>1h;10m/1-7,08:00-21:00</delay>
<history>30d</history>
<trends>0</trends>
<value_type>TEXT</value_type>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>JAVASCRIPT</type>
<params>return value.replace(/\s\(.+\)|\s\[.+\]|[\u00A0]/g, '') // Deleting data in brackets and spaces</params>
</step>
</preprocessing>
<trigger_prototypes>
<trigger_prototype>
<expression>{str("FAILING_NOW")}=1</expression>
<name>{#STORAGE.NAME}: One or more SMART attributes are "FAILING_NOW"</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>{#STORAGE.NAME}: SMART test status is "FAILED"</name>
<expression>{Template SMARTMONTOOLS:storage.health["{#STORAGE.CMD}"].str("FAILED!")}=1</expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: Test result</name>
<type>DEPENDENT</type>
<key>storage.health["{#STORAGE.CMD}"]</key>
<delay>0</delay>
<trends>0</trends>
<value_type>CHAR</value_type>
<description>HDD
SSD</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:SMART overall-health self-assessment test result:|SMART Health Status:) +\b([\S ]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{str("FAILED!")}=1</expression>
<name>{#STORAGE.NAME}: SMART test status is "FAILED"</name>
<priority>AVERAGE</priority>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: Device model</name>
<type>DEPENDENT</type>
<key>storage.model["{#STORAGE.CMD}"]</key>
<delay>0</delay>
<trends>0</trends>
<value_type>CHAR</value_type>
<description>HDD
SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:Vendor:|Product:|Device [Mm]odel:|Model [Nn]umber:).+ (.+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: Serial number</name>
<type>DEPENDENT</type>
<key>storage.sn["{#STORAGE.CMD}"]</key>
<delay>0</delay>
<trends>0</trends>
<value_type>CHAR</value_type>
<description>HDD
SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:Serial [Nn]umber:).+ ([\d\w-]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{diff()}=1</expression>
<recovery_mode>NONE</recovery_mode>
<name>{#STORAGE.NAME}: Disk has been replaced (new serial number received)</name>
<priority>INFO</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 05 Reallocated sectors count</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 05 Reallocated_Sector_Ct]</key>
<delay>0</delay>
<description>HDD
SSD</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:5 Reallocated|Elements in grown defect list:|5 Retired_Block_Count).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{diff()}=1</expression>
<recovery_mode>RECOVERY_EXPRESSION</recovery_mode>
<recovery_expression>{last()}=0 or {delta(864000)}=0</recovery_expression>
<name>{#STORAGE.NAME}: SMART reallocated sectors count has been registered</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>{#STORAGE.NAME}: SMART test status is "FAILED"</name>
<expression>{Template SMARTMONTOOLS:storage.health["{#STORAGE.CMD}"].str("FAILED!")}=1</expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 09 Power on hours</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 09 Power_On_Hours]</key>
<delay>0</delay>
<units>s</units>
<description>HDD
SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:9 Power_On_Hours|Power On Hours:|[Nn]umber of hours powered up|Accumulated power on time).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
<step>
<type>MULTIPLIER</type>
<params>3600</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 10 Spin retry count</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 10 Spin_Retry_Count]</key>
<delay>0</delay>
<description>HDD</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:10 Spin_Retry_Count).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{delta(7d)}>0</expression>
<name>{#STORAGE.NAME}: SMART spin retry count has been registered</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 190/194 Temperature</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 190/194 Temperature_Celsius]</key>
<delay>0</delay>
<units>°С</units>
<description>HDD
SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:190 Temperature|190 Airflow_Temperature|194 Temperature|Drive Temperature:|Temperature:).+ \w* (\d+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{avg(5m)}>{$TEMP_CRIT} and
{last()}<=100</expression>
<recovery_mode>RECOVERY_EXPRESSION</recovery_mode>
<recovery_expression>{avg(5m)}<{$TEMP_CRIT}-3</recovery_expression>
<name>{#STORAGE.NAME}: Disk temperature is "CRITICAL"</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
<trigger_prototype>
<expression>{avg(5m)}>{$TEMP_WARN}</expression>
<recovery_mode>RECOVERY_EXPRESSION</recovery_mode>
<recovery_expression>{avg(5m)}<{$TEMP_WARN}-3</recovery_expression>
<name>{#STORAGE.NAME}: Disk temperature is "WARNING"</name>
<priority>WARNING</priority>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>{#STORAGE.NAME}: Disk temperature is "CRITICAL"</name>
<expression>{Template SMARTMONTOOLS:storage["{#STORAGE.CMD}", 190/194 Temperature_Celsius].avg(5m)}>{$TEMP_CRIT} and
{Template SMARTMONTOOLS:storage["{#STORAGE.CMD}", 190/194 Temperature_Celsius].last()}<=100</expression>
<recovery_expression>{Template SMARTMONTOOLS:storage["{#STORAGE.CMD}", 190/194 Temperature_Celsius].avg(5m)}<{$TEMP_CRIT}-3</recovery_expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 197 Current pending sector count</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 197 Current_Pending_Sector]</key>
<delay>0</delay>
<description>HDD</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:197 Current_Pending_Sector|197\s+\w+_\w+).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{delta(3d)}>0</expression>
<name>{#STORAGE.NAME}: SMART current pending sector counter has been registered</name>
<priority>WARNING</priority>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>{#STORAGE.NAME}: SMART reallocated sectors count has been registered</name>
<expression>{Template SMARTMONTOOLS:storage["{#STORAGE.CMD}", 05 Reallocated_Sector_Ct].diff()}=1</expression>
<recovery_expression>{Template SMARTMONTOOLS:storage["{#STORAGE.CMD}", 05 Reallocated_Sector_Ct].last()}=0 or {Template SMARTMONTOOLS:storage["{#STORAGE.CMD}", 05 Reallocated_Sector_Ct].delta(864000)}=0</recovery_expression>
</dependency>
<dependency>
<name>{#STORAGE.NAME}: SMART test status is "FAILED"</name>
<expression>{Template SMARTMONTOOLS:storage.health["{#STORAGE.CMD}"].str("FAILED!")}=1</expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 198 Uncorrectable errors count</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 198 Offline_Uncorrectable]</key>
<delay>0</delay>
<description>HDD
SSD</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:Offline_Uncorrectable).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{diff()}=1</expression>
<name>{#STORAGE.NAME}: SMART uncorrectable sector count has been registered</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
<dependencies>
<dependency>
<name>{#STORAGE.NAME}: SMART test status is "FAILED"</name>
<expression>{Template SMARTMONTOOLS:storage.health["{#STORAGE.CMD}"].str("FAILED!")}=1</expression>
</dependency>
</dependencies>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 199/218 CRC error count</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 199/218 UDMA_CRC_Error]</key>
<delay>0</delay>
<description>HDD
SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:199 UDMA_CRC_Error|199 CRC_Error_Count|Non-medium error count:|Media and Data Integrity Errors:|199 SATA_CRC_Error|218 CRC_Error_Count).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{last()}>100 and {delta(1d)}>0</expression>
<name>{#STORAGE.NAME}: SMART UDMA CRC error count too high has been registered</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
<item_prototype>
<name>{#STORAGE.NAME}: ID 231 SSD life left</name>
<type>DEPENDENT</type>
<key>storage["{#STORAGE.CMD}", 231 SSD_Life_Left]</key>
<delay>0</delay>
<units>%</units>
<description>SSD
NVME</description>
<applications>
<application>
<name>SMART monitoring (smartctl)</name>
</application>
</applications>
<preprocessing>
<step>
<type>REGEX</type>
<params>(?:231 SSD_Life_Left |Available Spare: |231\s+\w+_\w+).+ ([0-9]+)
\1</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
<step>
<type>IN_RANGE</type>
<params>0
100</params>
<error_handler>CUSTOM_ERROR</error_handler>
<error_handler_params>Not supported</error_handler_params>
</step>
</preprocessing>
<master_item>
<key>storage.get["{#STORAGE.CMD}"]</key>
</master_item>
<trigger_prototypes>
<trigger_prototype>
<expression>{last()}<=10</expression>
<recovery_mode>RECOVERY_EXPRESSION</recovery_mode>
<recovery_expression>{last()}>10</recovery_expression>
<name>{#STORAGE.NAME}: SMART SSD life left</name>
<priority>AVERAGE</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
</item_prototypes>
<graph_prototypes>
<graph_prototype>
<name>{#STORAGE.NAME}: Smartctl temperature</name>
<graph_items>
<graph_item>
<color>1A7C11</color>
<item>
<host>Template SMARTMONTOOLS</host>
<key>storage["{#STORAGE.CMD}", 190/194 Temperature_Celsius]</key>
</item>
</graph_item>
</graph_items>
</graph_prototype>
</graph_prototypes>
</discovery_rule>
</discovery_rules>
<macros>
<macro>
<macro>{$TEMP_CRIT}</macro>
<value>65</value>
</macro>
<macro>
<macro>{$TEMP_WARN}</macro>
<value>55</value>
</macro>
</macros>
</template>
</templates>
</zabbix_export>