v-zhuravlev / zbx-smartctl

Templates and scripts for monitoring disks health with Zabbix and smartmontools
https://share.zabbix.com/storage-devices/smartmontools/smart-monitoring-with-smartmontools-lld
GNU General Public License v3.0
245 stars 127 forks source link

smartctl-disks-discovery.pl: get list of block devices with lsblk #12

Closed asg7443 closed 8 years ago

asg7443 commented 8 years ago

It seems to me using lsblk is simpler and it's output doesn't include virtual devices like md0.

v-zhuravlev commented 8 years ago

Hi, thanks for sharing.

But it shows DRBD disks for example: ls

$ ls -l /dev/disk/by-id/ | cut -d"/" -f3 | sort -n | uniq -w 3
dm-0
sda
sr0
total 0

lsblk

$ /bin/lsblk -d -n -o NAME
sr0
sda
drbd1
drbd2
drbd3
asg7443 commented 8 years ago

Fixed. Probably there are other device types which don't support SMART (see http://www.lanana.org/docs/device-list/devices-2.6+.txt) but I think it doesn't make sense to try to exclude them all since they should be filtered by '{#SMART_ENABLED}' in Zabbix template.

v-zhuravlev commented 8 years ago

@asg7443 , what do you think about using smartctl --scan ? There are cases when lsblk is not available: http://askubuntu.com/questions/434150/is-lsblk-not-available-for-ubuntu10-04

asg7443 commented 8 years ago

Well, it's pretty natural way to do it. How did we miss it earlier?.. :)