Add support for the S.M.A.R.T monitoring to the Zabbix Agent 2 out of the box
(ZBXNEXT-5924)
|
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Agent2 plugin (G) |
Affects Version/s: | None |
Fix Version/s: | 5.0.9rc1, 5.2.5rc1, 5.4.0alpha2, 5.4 (plan) |
Type: | Specification change (Sub-task) | Priority: | Trivial |
Reporter: | Aleksandrs Larionovs (Inactive) | Assignee: | Eriks Sneiders |
Resolution: | Fixed | Votes: | 2 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() ![]() ![]() |
||||||||
Issue Links: |
|
||||||||
Team: | |||||||||
Sprint: | Sprint 70 (Nov 2020), Sprint 71 (Dec 2020), Sprint 72 (Jan 2021), Sprint 73 (Feb 2021), Sprint 74 (Mar 2021) | ||||||||
Story Points: | 5 |
Description |
Create Agent2 plugin
|
Comments |
Comment by Eriks Sneiders [ 2021 Feb 12 ] |
Available in:
Updated documentation: |
Comment by Nikolay Kulikov [ 2021 Feb 15 ] |
Maybe good idea: pushing all data in one attempt (discovery and info), cause last smartctl version is giving info in json for device, and for discovering you looping through all devices in any case |
Comment by Eriks Sneiders [ 2021 Feb 26 ] |
Could mykolaq you please explain a bit more what you mean by this? Because, as I understand we are doing it similarly. |
Comment by Max B [ 2021 Mar 03 ] |
This option is not very convenient. The smart.disk.discovery and smart.attribute.discovery commands can be used for discovery. But how to use them later is not entirely clear to me. The smart.disk.get command gives all the information and does not have input parameters such as the disk name for example. It would be much more convenient. Considering that the latest version of smartctl can output information in json format, working with the current plugin implementation is only more difficult. <mchudinov> Hello Max. I would suggest you use the out-of-box template as an example of using plugin keys. They discover all disks (include RAID) and all their attributes. We were trying to make a universal solution so users don't need to search disk names. The plugin uses smartctl json-format output to get all data from all disks for one request of the Zabbix agent. The plugin will find disks itself, you don't need to define the name in the item key. |
Comment by Max B [ 2021 Mar 05 ] |
Thanks for the answer. I took your advice and understood how it works. But I ran into some problem (possibly a bug). Agent 2 version - 5.2.5, OS - Windows 10 If I use the smartctl disk listing command on the local machine, I get this result: c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe --scan /dev/sda -d ata # /dev/sda, ATA device /dev/sdb -d ata # /dev/sdb, ATA device /dev/csmi0,0 -d ata # /dev/csmi0,0, ATA device /dev/csmi0,1 -d ata # /dev/csmi0,1, ATA device /dev/csmi0,3 -d ata # /dev/csmi0,3, ATA device If you make a request with a module command via zabbix_get, the result is different: root@ZABBIX-SKUD:~# zabbix_get -s 10.100.40.108 -p 10150 -k smart.disk.discovery [{ "{#NAME}": "sda", "{#DISKTYPE}": "HDD", "{#MODEL}": "ST1000DM003-1ER162", "{#SN}": "Z4Y1S7B6" },{ "{#NAME}": "sdb", "{#DISKTYPE}": "HDD", "{#MODEL}": "ST4000DM000-1F2168", "{#SN}": "Z300D821" }] But he may be like that: root@ZABBIX-SKUD:~# zabbix_get -s 10.100.40.108 -p 10150 -k smart.disk.discovery [{ "{#NAME}": "csmi0,1", "{#DISKTYPE}": "HDD", "{#MODEL}": "ST4000DM000-1F2168", "{#SN}": "Z300D821" },{ "{#NAME}": "csmi0,0", "{#DISKTYPE}": "HDD", "{#MODEL}": "ST1000DM003-1ER162", "{#SN}": "Z4Y1S7B6" }] As you can see, the names of the disks change, it happens that they are mixed with each other. As a result, the following errors appear in the data items: In the above example, there are only two hard drives, the third item is CD-ROM Drive. The smartctl utility does not always display smart information for both types of drive names. In the example described, there are only two hard drives, the third item is CD-ROM Drive. The smartctl utility does not always display smart information for both types of drive names. I faced this problem before the release of the module for zabbix2, when I tried to do disk polling using smartmontools myself. In smartmontool, you can specify the media type when listing drives, for example:
c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe -j --scan -d { "json_format_version":[1,0], "smartctl":{"version":[7,2], "svn_revision":"5155", "platform_info":"i686-w64-mingw32-w10-1809(64)", "build_info":"(sf-7.2-1)", "argv":["smartctl","-j","--scan","-d"], "messages":[{ "string":"=======> ARGUMENT REQUIRED FOR OPTION: d","severity":"error"},{"string":"=======> VALID ARGUMENTS ARE: ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], sntrealtek, intelliprop,N[+TYPE], jmb39x[-q],N[,sLBA][,force][+TYPE], jms56x,N[,sLBA][,force][+TYPE], aacraid,H,L,ID, areca,N[/E], auto, test <=======","severity":"error"}],"exit_status":1} } c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe -j --scan -d ata { "json_format_version":[1,0], "smartctl":{ "version":[7,2], "svn_revision":"5155", "platform_info":"i686-w64-mingw32-w10-1809(64)", "build_info":"(sf-7.2-1)", "argv":["smartctl","-j","--scan","-d","ata"],"exit_status":0 }, "devices":[ {"name":"/dev/sda","info_name":"/dev/sda","type":"ata","protocol":"ATA"}, {"name":"/dev/sdb","info_name":"/dev/sdb","type":"ata","protocol":"ATA"}] } c:\zabbix_agent2\userfiles\smartmontools32\bin>smartctl.exe -j --scan -d csmi { "json_format_version":[1,0], "smartctl":{ "version":[7,2], "svn_revision":"5155", "platform_info":"i686-w64-mingw32-w10-1809(64)", "build_info":"(sf-7.2-1)", "argv":["smartctl","-j","--scan","-d","csmi"],"exit_status":0}, "devices":[ {"name":"/dev/csmi0,0","info_name":"/dev/csmi0,0","type":"ata","protocol":"ATA"}, {"name":"/dev/csmi0,1","info_name":"/dev/csmi0,1","type":"ata","protocol":"ATA"}, {"name":"/dev/csmi0,3","info_name":"/dev/csmi0,3","type":"ata","protocol":"ATA"}] }
But on computers that display multiple drive name formats, you need to manually check for the correct one. Until now, I have not been able to understand by what sign or parameter they can be determined automatically. |
Comment by Aleksandrs Larionovs (Inactive) [ 2021 Mar 09 ] |
Skamer, I have moved your issue to ZBX as it correspond to a bug report. (https://support.zabbix.com/browse/ZBX-19103) |