Closed v-zhuravlev closed 6 years ago
As I know, 231 is not for any SSD manufactures:
Do you know another types?
Samsung - 177
"Corsair with SandForce — 231 SSD_Life_Left, Crucial with Micron — 173 Ave_Block-Erase_Count, 202 Percent_Lifetime_Used"
do those have 233? Do you have example output you can share for those disks?
Because having the same rules for HDD and SSD I had errors in server logs with specific SMART attributes types missing for the other.
I filtered them with:
"{#DISKNAME}":"/dev/sdl -d sat",
"{#IS_SSD}":"0",
"{#SMART_ENABLED}":"1"
},
{
"{#DISKNAME}":"/dev/sdm -d scsi",
"{#IS_SSD}":"0",
"{#SMART_ENABLED}":"0"
},
{
"{#DISKNAME}":"/dev/bus/0 -d sat+megaraid,12",
"{#IS_SSD}":"1",
"{#SMART_ENABLED}":"1"
},
to find out if SSD I look for the line "Rotation Rate: Solid State Device". /sys/block/$disk_name_s/queue/rotational does not show for RAID discoverted devices that are however correctly discovered
Then I modified the LLD to have 3 rules, 1 generic, 1 with SSD specific attributes, 1 with HDD specific attributes.
I had to duplicates the master items because you cannot have a dependent item for SSD that depends on master item from generic discovery rules for instance. Had to break trigger depency too.
added #DISKTYPE https://github.com/v-zhuravlev/zbx-smartctl/pull/59 macro with values 0 -HHD, 1-SSD, 0-Other. this now can be used for separate discovery rules. Not sure whether it should be separated though in the templates stored here.
"Под Linux, оказывается, можно всего одной командой определить какой диск - SSD или HDD:
Linux automatically detects SSD, and since kernel version 2.6.29, you may verify sda with: cat /sys/block/sda/queue/rotational You should get 1 for hard disks and 0 for a SSD.
То есть, можно добавить в perl-script еще одну проверку с всего одной командой, вывод которой даст определение типа диска - 1 или 0.
Далее добавить еще один RegExp "DISK_TYPE". Если он - "1", то ничего делать не надо. Если он "0" и имеем дело с SSD, то надо делать еще одно Правило обнаружения с элементами данных под SSD. Там самое главное - это 231-й параметр вывода smartctl, который и показывает "Здоровье диска". Из остальных параметров можно оставить 5, 9, 194 (надо редактировать), инвентарные данные, а так же Test Result. Все остальное не актуально для SSD.
Вот только, насколько я знаю, несколько RegExp в Правилах обнаружения Zabbix умеет в версии 3+. На 2.2 и 2.4 придется играться с глобальными регулярками, и писать правила туда. Для HDD это будет "SMART_ENABLED = 1 и DISK_TYPE = 1", для SSD - "SMART_ENABLED = 1 и DISK_TYPE = 0"
В общем, все можно красиво реализовать. И было бы просто потрясающе сделать модернизацию шаблона.
Спасибо! :)"