nikimaxim / zbx-smartmonitor Goto Github PK
View Code? Open in Web Editor NEWZabbix template for monitoring disk attributes
License: GNU General Public License v3.0
Zabbix template for monitoring disk attributes
License: GNU General Public License v3.0
I have 7 disks in my server:
root@server1:/opt/zabbix# smartctl --scan-open | sed -e 's/\s*$/;/'
/dev/sda -d scsi # /dev/sda, SCSI device;
/dev/sdb -d scsi # /dev/sdb, SCSI device;
/dev/sdc -d scsi # /dev/sdc, SCSI device;
/dev/sdd -d scsi # /dev/sdd, SCSI device;
/dev/sde -d scsi # /dev/sde, SCSI device;
/dev/sdf -d sat # /dev/sdf [SAT], ATA device;
/dev/sdg -d sat # /dev/sdg [SAT], ATA device;
/dev/bus/0 -d megaraid,0 # /dev/bus/0 [megaraid_disk_00], SCSI device;
/dev/bus/0 -d megaraid,1 # /dev/bus/0 [megaraid_disk_01], SCSI device;
/dev/bus/0 -d megaraid,2 # /dev/bus/0 [megaraid_disk_02], SCSI device;
/dev/bus/0 -d megaraid,3 # /dev/bus/0 [megaraid_disk_03], SCSI device;
/dev/bus/0 -d megaraid,4 # /dev/bus/0 [megaraid_disk_04], SCSI device;
/dev/bus/0 -d sat+megaraid,5 # /dev/bus/0 [megaraid_disk_05] [SAT], ATA device;
/dev/bus/0 -d sat+megaraid,6 # /dev/bus/0 [megaraid_disk_06] [SAT], ATA device;
...and...
root@server1:/opt/zabbix# /usr/sbin/smartctl -i /dev/sda -dscsi
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-74-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: TOSHIBA
Product: MG03SCA100
Revision: DG09
Compliance: SPC-4
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
Logical block size: 512 bytes
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
Logical Unit id: 0x5000039618e9cfa5
Serial number: NNNNNNNNN
Device type: disk
Transport protocol: SAS (SPL-3)
Local Time is: Thu Jun 24 10:56:29 2021 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Temperature Warning: Disabled or Not Supported
Current behaviour vs probable fix...
root@server1:/opt/zabbix# /bin/echo "Serial number: NNNNNNNNNN" | grep "Serial Number:" | cut -f2 -d":" | sed -e 's/^\s*//'
root@server1:/opt/zabbix# /bin/echo "Serial number: NNNNNNNNNN" | grep -i "Serial Number:" | cut -f2 -d":" | sed -e 's/^\s*//'
NNNNNNNNNN
root@server1:/opt/zabbix#
Hi,
I was looking through the template but not sure exactly how and where rules are set to trigger a problem that can be seen from the Dashboard when a disk is starting to get errors, to give us time to change the disk before it stops working. Could someone point me in the right direction?
The reason is perhaps I may need to modify this to get early reports of problems.
Hello!
Can you help me to understand, why second NVMe disk doesn't show up in the script
When i'm scanning with --scan-open command, i'm seeing this:
C:\Windows\system32>"C:\Program Files\smartmontools\bin\smartctl.exe" --scan-open
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/csmi3,2 -d ata # /dev/csmi3,2, ATA device
/dev/csmi3,3 -d ata # /dev/csmi3,3, ATA device
/dev/nvme0 -d nvme # /dev/nvme0, NVMe device
/dev/nvme1 -d nvme # /dev/nvme1, NVMe device
But when i'm scan my discs with script, nvme1 for some reason doesn't show up in the results:
C:\Windows\system32>powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Zabbix\smartctl-storage-discovery.ps1"
{
"data":[
{
"{#STORAGE.SN}":"BTYF91640xxxxxxxx",
"{#STORAGE.MODEL}":"INTEL SSDSC2KB960G8",
"{#STORAGE.NAME}":"/dev/csmi3,2",
"{#STORAGE.CMD}":"/dev/csmi3,2 -data",
"{#STORAGE.SMART}":"1",
"{#STORAGE.TYPE}":"1"
},
{
"{#STORAGE.SN}":"BTYF91640xxxxxxx",
"{#STORAGE.MODEL}":"INTEL SSDSC2KB960G8",
"{#STORAGE.NAME}":"/dev/csmi3,3",
"{#STORAGE.CMD}":"/dev/csmi3,3 -data",
"{#STORAGE.SMART}":"1",
"{#STORAGE.TYPE}":"1"
},
{
"{#STORAGE.SN}":"69B0Axxxxxxx",
"{#STORAGE.MODEL}":"KCM51VUG800G",
"{#STORAGE.NAME}":"/dev/nvme0",
"{#STORAGE.CMD}":"/dev/nvme0 -dnvme",
"{#STORAGE.SMART}":"1",
"{#STORAGE.TYPE}":"2"
}
]
}
Hi,
I have installed everything on the Promox HOST, am able to get information on all my HDDs and SSDs and the zabbix-agent starts without any issues however, the only information I get on Zabbix Server 5.0 is "Smartctl version", nothing else gets sent no matter what I do.
This comes from the Promox host where the agent is installed so the setup there appears to be good :
I get this error on the zabbix console, I am logged in as admin when I try and import the XML template file into my Zabbix server running 5.4.4 on Ubuntu.
Error in query [INSERT INTO items (name,type,delay,trends,value_type,description,uuid,snmp_oid,history,status,discover,units,params,ipmi_sensor,authtype,username,password,publickey,privatekey,inventory_link,logtimefmt,jmx_endpoint,timeout,url,query_fields,posts,status_codes,follow_redirects,post_type,http_proxy,headers,retrieve_mode,request_method,output_format,allow_traps,ssl_cert_file,ssl_key_file,ssl_key_password,verify_peer,verify_host,key_,trapper_hosts,hostid,master_itemid,flags,itemid) VALUES ('{#STORAGE.NAME}: Error сount','18','0','0','1','HDD\r\nSSD\r\nNVME','8172fb0ab1df4a7ba09e02b1f496c838','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.error[\"{#STORAGE.CMD}\"]','','10126','25203','2','25204'),('{#STORAGE.NAME}: Test result','18','0','0','1','HDD\r\nSSD','42718d36f25946b0941cb02bc93ad956','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.health[\"{#STORAGE.CMD}\"]','','10126','25203','2','25205'),('{#STORAGE.NAME}: Device model','18','0','0','1','HDD\r\nSSD\r\nNVME','e02b26d159714a14ae5c52e984414185','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.model[\"{#STORAGE.CMD}\"]','','10126','25203','2','25206'),('{#STORAGE.NAME}: Serial number','18','0','0','1','HDD\r\nSSD\r\nNVME','21fa0ab926a04364824fe26ec12a884c','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.sn[\"{#STORAGE.CMD}\"]','','10126','25203','2','25207'),('{#STORAGE.NAME}: ID 05 Reallocated sectors count','18','0','365d','3','HDD\r\nSSD','9a9ae335f86e49a8b4bff1b635f2fe1f','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 05 Reallocated_Sector_Ct]','','10126','25203','2','25208'),('{#STORAGE.NAME}: ID 09 Power on hours','18','0','365d','3','HDD\r\nSSD\r\nNVME','191e995761a24bf4abadfade95221e5d','','90d','0','0','s','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 09 Power_On_Hours]','','10126','25203','2','25209'),('{#STORAGE.NAME}: ID 10 Spin retry count','18','0','365d','3','HDD','aa79f34515bf4353a2c3a2084c72e27e','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 10 Spin_Retry_Count]','','10126','25203','2','25210'),('{#STORAGE.NAME}: ID 190/194 Temperature','18','0','365d','3','HDD\r\nSSD\r\nNVME','869eb22bb22b4d6e92653428fdaf8429','','90d','0','0','°С','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 190/194 Temperature_Celsius]','','10126','25203','2','25211'),('{#STORAGE.NAME}: ID 197 Current pending sector count','18','0','365d','3','HDD','e14b593365be4c0dbdf05baba9ecb1fd','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 197 Current_Pending_Sector]','','10126','25203','2','25212'),('{#STORAGE.NAME}: ID 198 Uncorrectable errors count','18','0','365d','3','HDD\r\nSSD','21145caa5cfb4868bc93f61c3cc3ceab','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 198 Offline_Uncorrectable]','','10126','25203','2','25213'),('{#STORAGE.NAME}: ID 199/218 CRC error count','18','0','365d','3','HDD\r\nSSD\r\nNVME','e13719f6027143018a7ba2d293e096fa','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 199/218 UDMA_CRC_Error]','','10126','25203','2','25214'),('{#STORAGE.NAME}: ID 231 SSD life left','18','0','365d','3','SSD\r\nNVME','aaabd1f881c64ff9abefd1b08c7f98d9','','90d','0','0','%','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 231 SSD_Life_Left]','','10126','25203','2','25215')] [Incorrect string value: '\xD1\x81ount' for column 'name' at row 1]
SQL statement execution has failed "INSERT INTO items (name,type,delay,trends,value_type,description,uuid,snmp_oid,history,status,discover,units,params,ipmi_sensor,authtype,username,password,publickey,privatekey,inventory_link,logtimefmt,jmx_endpoint,timeout,url,query_fields,posts,status_codes,follow_redirects,post_type,http_proxy,headers,retrieve_mode,request_method,output_format,allow_traps,ssl_cert_file,ssl_key_file,ssl_key_password,verify_peer,verify_host,key_,trapper_hosts,hostid,master_itemid,flags,itemid) VALUES ('{#STORAGE.NAME}: Error сount','18','0','0','1','HDD\r\nSSD\r\nNVME','8172fb0ab1df4a7ba09e02b1f496c838','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.error[\"{#STORAGE.CMD}\"]','','10126','25203','2','25204'),('{#STORAGE.NAME}: Test result','18','0','0','1','HDD\r\nSSD','42718d36f25946b0941cb02bc93ad956','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.health[\"{#STORAGE.CMD}\"]','','10126','25203','2','25205'),('{#STORAGE.NAME}: Device model','18','0','0','1','HDD\r\nSSD\r\nNVME','e02b26d159714a14ae5c52e984414185','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.model[\"{#STORAGE.CMD}\"]','','10126','25203','2','25206'),('{#STORAGE.NAME}: Serial number','18','0','0','1','HDD\r\nSSD\r\nNVME','21fa0ab926a04364824fe26ec12a884c','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.sn[\"{#STORAGE.CMD}\"]','','10126','25203','2','25207'),('{#STORAGE.NAME}: ID 05 Reallocated sectors count','18','0','365d','3','HDD\r\nSSD','9a9ae335f86e49a8b4bff1b635f2fe1f','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 05 Reallocated_Sector_Ct]','','10126','25203','2','25208'),('{#STORAGE.NAME}: ID 09 Power on hours','18','0','365d','3','HDD\r\nSSD\r\nNVME','191e995761a24bf4abadfade95221e5d','','90d','0','0','s','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 09 Power_On_Hours]','','10126','25203','2','25209'),('{#STORAGE.NAME}: ID 10 Spin retry count','18','0','365d','3','HDD','aa79f34515bf4353a2c3a2084c72e27e','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 10 Spin_Retry_Count]','','10126','25203','2','25210'),('{#STORAGE.NAME}: ID 190/194 Temperature','18','0','365d','3','HDD\r\nSSD\r\nNVME','869eb22bb22b4d6e92653428fdaf8429','','90d','0','0','°С','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 190/194 Temperature_Celsius]','','10126','25203','2','25211'),('{#STORAGE.NAME}: ID 197 Current pending sector count','18','0','365d','3','HDD','e14b593365be4c0dbdf05baba9ecb1fd','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 197 Current_Pending_Sector]','','10126','25203','2','25212'),('{#STORAGE.NAME}: ID 198 Uncorrectable errors count','18','0','365d','3','HDD\r\nSSD','21145caa5cfb4868bc93f61c3cc3ceab','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 198 Offline_Uncorrectable]','','10126','25203','2','25213'),('{#STORAGE.NAME}: ID 199/218 CRC error count','18','0','365d','3','HDD\r\nSSD\r\nNVME','e13719f6027143018a7ba2d293e096fa','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 199/218 UDMA_CRC_Error]','','10126','25203','2','25214'),('{#STORAGE.NAME}: ID 231 SSD life left','18','0','365d','3','SSD\r\nNVME','aaabd1f881c64ff9abefd1b08c7f98d9','','90d','0','0','%','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 231 SSD_Life_Left]','','10126','25203','2','25215')".
In Zabbix, data is displayed in the form of graphs, the same data in Grafana is not displayed
Hello.
It's possible insert to ID 12 in the template.
Hi,
I've found a problem with "{#STORAGE.NAME}: ID 190/194 Temperature".
It works for most of my drives but two drives exeeded the temperatur threshold once and smartmon set the "WHEN_FAILED" value from "-" to "In_the_past". Now the regex will will read the "THRESH" value (050) as the Temperature (50 C) but not the first number in the "RAW_VALUE".
This is what my smartmon returns me:
smartctl -i -H -A -l error -l background /dev/sda
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.34-1-pve] (local build)
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x002f 100 100 050 Pre-fail Always - 0
5 Reallocate_NAND_Blk_Cnt 0x0032 100 100 010 Old_age Always - 0
9 Power_On_Hours 0x0032 100 100 050 Old_age Always - 109
12 Power_Cycle_Count 0x0032 100 100 050 Old_age Always - 26
171 Program_Fail_Count 0x0032 100 100 050 Old_age Always - 0
172 Erase_Fail_Count 0x0032 100 100 050 Old_age Always - 0
173 Ave_Block-Erase_Count 0x0032 100 100 050 Old_age Always - 3
174 Unexpect_Power_Loss_Ct 0x0032 100 100 050 Old_age Always - 15
180 Unused_Reserve_NAND_Blk 0x0032 100 100 050 Old_age Always - 100
183 SATA_Interfac_Downshift 0x0032 100 100 050 Old_age Always - 0
184 Error_Correction_Count 0x0032 100 100 050 Old_age Always - 0
187 Reported_Uncorrect 0x0032 100 100 050 Old_age Always - 0
194 Temperature_Celsius 0x0022 058 047 050 Old_age Always In_the_past 42 (Min/Max 31/53)
196 Reallocated_Event_Count 0x0032 100 100 050 Old_age Always - 0
197 Current_Pending_Sector 0x0032 100 100 050 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 100 050 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0032 100 100 050 Old_age Always - 0
202 Percent_Lifetime_Remain 0x0030 100 100 001 Old_age Offline - 100
206 Write_Error_Rate 0x002e 100 100 050 Old_age Always - 0
210 Success_RAIN_Recov_Cnt 0x0032 100 100 050 Old_age Always - 0
246 Total_LBAs_Written 0x0032 100 100 050 Old_age Always - 254063685
247 Host_Program_Page_Count 0x0032 100 100 050 Old_age Always - 7939490
248 FTL_Program_Page_Count 0x0032 100 100 050 Old_age Always - 1548288
SMART Error Log Version: 1
No Errors Logged
As soon as I add second space after"In_the_past" regex will match that "42" again but I don't know how to fix the regex pattern so it will work.
Could you fix pleace, the path in zabbix_agent.conf for windows:
C:\service\zabbix_agent\smartctl-storage-discovery.ps1
because write now is not correct:
C:\service\smartctl-storage-discovery.ps1
Thanks
Hello, I suggest that it's better to have a file to go into sudoers.d
so have this as, say, _etc_sudoers.d_zabbix_smartmonitor
Defaults:zabbix !requiretty
zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl
zabbix ALL=(root) NOPASSWD: /opt/zabbix/bin/smartctl-storage-discovery.sh
and tell people to copy it to remote hosts thus:
scp -p _etc_sudoers.d_zabbix_smartmonitor 1.2.3.4:/tmp/
ssh 1.2.3.4 "sudo mv _etc_sudoers.d_zabbix_smartmonitor /etc/sudoers.d/zabbix_smartmonitor"
Hello, the script displays data on hard disks in the console, but on the side of the Zabbix server there is a problem, it reports that the data is not correct and is waiting for an opening curly brace if I understood correctly.
Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the pri
Hello,
I has install zbx-smartmonitor to agent. And import to server.But it's will unsupport item key.It's not support smartctl.version this item.How to fix it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.