Skip to content

Instantly share code, notes, and snippets.

@wheel5up
Created April 6, 2024 16:48
Show Gist options
  • Save wheel5up/022f9067a66acf9c7f2235f10d1d6266 to your computer and use it in GitHub Desktop.
Save wheel5up/022f9067a66acf9c7f2235f10d1d6266 to your computer and use it in GitHub Desktop.
QNAP SMART discovery with Zabbix 6.4
zabbix_export:
version: '6.4'
template_groups:
- uuid: e960332b3f6c46a1956486d4f3f99fce
name: 'Templates/Server hardware'
templates:
- uuid: ba541537a40f46eab3d292300ad4f062
template: 'QNAP SMART discovery'
name: 'QNAP SMART discovery'
description: 'QNAP SMART attributes'
groups:
- name: 'Templates/Server hardware'
items:
- uuid: df35d41b4383497aabb80e072d75ea23
name: 'QNAP Disk SMART get'
key: qnap.disk.smart.get
delay: 5m
trends: '0'
value_type: TEXT
tags:
- tag: component
value: storage
- tag: system
value: smart
discovery_rules:
- uuid: c9ca3f32e4ae4c4fb0efa9d3f1e8592e
name: 'Discover QNAP disk SMART data'
type: DEPENDENT
key: qnap.disk.smart.discovery
delay: '0'
item_prototypes:
- uuid: 64193d95d07847e2807ac8046147fb7c
name: 'Disk {#PDSYSNAME} SMART {#SMRTID}:{#SMRTNAME} raw'
type: DEPENDENT
key: 'qnap.disk.smart[{#PDSYSNAME},{#SMRTNAME},raw]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.pdsysid == ''{#PDSYSID}'' && @.smrtname == ''{#SMRTNAME}'')].smrtdata.raw.first()'
master_item:
key: qnap.disk.smart.get
tags:
- tag: component
value: storage
- tag: disk
value: '{#PDSYSNAME}'
- tag: portid
value: '{#PORTID}'
- tag: portsysid
value: '{#PDSYSID}'
- tag: smartid
value: '{#SMRTID}'
- tag: smartname
value: '{#SMRTNAME}'
- tag: smartvalue
value: raw
trigger_prototypes:
- uuid: 826cd3adee8442c08b13d874bfa9a329
expression: 'last(/QNAP SMART discovery/qnap.disk.smart[{#PDSYSNAME},{#SMRTNAME},raw])<>0'
name: 'Trigger Disk {#PDSYSNAME} SMART {#SMRTID}:{#SMRTNAME} raw greater than zero'
priority: HIGH
tags:
- tag: component
value: storage
- tag: smartid
value: '{#SMRTID}'
- tag: smartname
value: '{#SMRTNAME}'
- uuid: 92131fc2d0f24325bed209083d690fdd
name: 'Disk {#PDSYSNAME} SMART {#SMRTID}:{#SMRTNAME} status'
type: DEPENDENT
key: 'qnap.disk.smart[{#PDSYSNAME},{#SMRTNAME},status]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.pdsysid == ''{#PDSYSID}'' && @.smrtname == ''{#SMRTNAME}'')].smrtdata.status.first()'
master_item:
key: qnap.disk.smart.get
tags:
- tag: component
value: storage
- tag: disk
value: '{#PDSYSNAME}'
- tag: portid
value: '{#PORTID}'
- tag: portsysid
value: '{#PDSYSID}'
- tag: smartid
value: '{#SMRTID}'
- tag: smartname
value: '{#SMRTNAME}'
- tag: smartvalue
value: status
- uuid: 806b7d82cc3640349240babd1bd4c144
name: 'Disk {#PDSYSNAME} SMART {#SMRTID}:{#SMRTNAME} threshold'
type: DEPENDENT
key: 'qnap.disk.smart[{#PDSYSNAME},{#SMRTNAME},threshold]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.pdsysid == ''{#PDSYSID}'' && @.smrtname == ''{#SMRTNAME}'')].smrtdata.threshold.first()'
master_item:
key: qnap.disk.smart.get
tags:
- tag: component
value: storage
- tag: disk
value: '{#PDSYSNAME}'
- tag: portid
value: '{#PORTID}'
- tag: portsysid
value: '{#PDSYSID}'
- tag: smartid
value: '{#SMRTID}'
- tag: smartname
value: '{#SMRTNAME}'
- tag: smartvalue
value: threshold
- uuid: 45a52159657947fbbe8915ca419fb3a5
name: 'Disk {#PDSYSNAME} SMART {#SMRTID}:{#SMRTNAME} value'
type: DEPENDENT
key: 'qnap.disk.smart[{#PDSYSNAME},{#SMRTNAME},value]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.pdsysid == ''{#PDSYSID}'' && @.smrtname == ''{#SMRTNAME}'')].smrtdata.value.first()'
master_item:
key: qnap.disk.smart.get
tags:
- tag: component
value: storage
- tag: disk
value: '{#PDSYSNAME}'
- tag: portid
value: '{#PORTID}'
- tag: portsysid
value: '{#PDSYSID}'
- tag: smartid
value: '{#SMRTID}'
- tag: smartname
value: '{#SMRTNAME}'
- tag: smartvalue
value: value
- uuid: 5a3445cb69744bc28a1399e9fdc44bdb
name: 'Disk {#PDSYSNAME} SMART {#SMRTID}:{#SMRTNAME} worst'
type: DEPENDENT
key: 'qnap.disk.smart[{#PDSYSNAME},{#SMRTNAME},worst]'
delay: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.[?(@.pdsysid == ''{#PDSYSID}'' && @.smrtname == ''{#SMRTNAME}'')].smrtdata.worst.first()'
master_item:
key: qnap.disk.smart.get
tags:
- tag: component
value: storage
- tag: disk
value: '{#PDSYSNAME}'
- tag: portid
value: '{#PORTID}'
- tag: portsysid
value: '{#PDSYSID}'
- tag: smartid
value: '{#SMRTID}'
- tag: smartname
value: '{#SMRTNAME}'
- tag: smartvalue
value: worst
master_item:
key: qnap.disk.smart.get
lld_macro_paths:
- lld_macro: '{#PDSYSID}'
path: $.pdsysid
- lld_macro: '{#PDSYSNAME}'
path: $.pdsysname
- lld_macro: '{#PORTID}'
path: $.portid
- lld_macro: '{#SMRTID}'
path: $.smrtid
- lld_macro: '{#SMRTNAME}'
path: $.smrtname
overrides:
- name: 'Don''t create triggers'
step: '1'
filter:
conditions:
- macro: '{#SMRTNAME}'
operator: EXISTS
formulaid: A
operations:
- operationobject: TRIGGER_PROTOTYPE
operator: LIKE
value: Disk
status: DISABLED
discover: NO_DISCOVER
- name: 'Enable trigger 5:Retired_Block_Count'
step: '2'
filter:
conditions:
- macro: '{#SMRTNAME}'
value: Retired_Block_Count
formulaid: A
operations:
- operationobject: TRIGGER_PROTOTYPE
operator: LIKE
value: Retired_Block_Count
status: ENABLED
discover: DISCOVER
- name: 'Enable trigger 187:Reported_Uncorrect_Error'
step: '3'
filter:
conditions:
- macro: '{#SMRTNAME}'
value: Reported_Uncorrect_Error
formulaid: A
operations:
- operationobject: TRIGGER_PROTOTYPE
operator: LIKE
value: Reported_Uncorrect_Error
status: ENABLED
discover: DISCOVER
- name: 'Enable trigger 188:Command_Timeout'
step: '4'
filter:
conditions:
- macro: '{#SMRTNAME}'
value: Command_Timeout
formulaid: A
operations:
- operationobject: TRIGGER_PROTOTYPE
operator: LIKE
value: Command_Timeout
status: ENABLED
discover: DISCOVER
- name: 'Enable trigger 197:Current_Pending_Sector'
step: '5'
filter:
conditions:
- macro: '{#SMRTNAME}'
value: Current_Pending_Sector
formulaid: A
operations:
- operationobject: TRIGGER_PROTOTYPE
operator: LIKE
value: Current_Pending_Sector
status: ENABLED
discover: DISCOVER
- name: 'Enable trigger 198:Uncorrectable_Sector_Count'
step: '6'
filter:
conditions:
- macro: '{#SMRTNAME}'
value: Uncorrectable_Sector_Count
formulaid: A
operations:
- operationobject: TRIGGER_PROTOTYPE
operator: LIKE
value: Uncorrectable_Sector_Count
status: ENABLED
discover: DISCOVER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment