nikimaxim / zbx-smartmonitor

Zabbix template for monitoring disk attributes
GNU General Public License v3.0
37 stars 14 forks source link

Some disks don't not included where Serial Number is presented wrong #8

Closed Whytey closed 3 years ago

Whytey commented 3 years ago

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# 
Whytey commented 3 years ago

Pull request #7 submitted as probable fix.

nikimaxim commented 3 years ago

Thank you.