-
Notifications
You must be signed in to change notification settings - Fork 0
/
zabbix_smart_scrubbed.sh
55 lines (45 loc) · 3.06 KB
/
zabbix_smart_scrubbed.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#set zabbix server/proxy info
zabbixServer=$zabbixServerOrProxy
zabbixName=$zabbixMonitoredHostName
for device in $(ssh root@$yourESXiHost esxcli storage core device list | grep "^t10.NVMe") ;
do
#Health Status
healthStatus=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Health Status" | awk '{print $3}')
zabbixKey=$org.esxi.smart.$device.health
zabbixValue=$healthStatus
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
#Reallocated Sectors
reallocatedSectors=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Reallocated Sector Count" | awk '{print $4}')
zabbixKey=$org.esxi.smart.$device.reallocated
zabbixValue=$reallocatedSectors
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
#Drive Temperature
driveTemp=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Drive Temperature" | awk '{print $3}')
zabbixKey=$org.esxi.smart.$device.drive_temp
zabbixValue=$driveTemp
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
done
for device in $(ssh root@$yourESXiHost esxcli storage core device list | grep "^naa") ;
do
#Health Status
healthStatus=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Health Status" | awk '{print $3}')
zabbixKey=$org.esxi.smart.$device.health
zabbixValue=$healthStatus
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
#Write Error Count
writeErrors=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Write Error Count" | awk '{print $4}')
zabbixKey=$org.esxi.smart.$device.write_errors
zabbixValue=$writeErrors
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
#Read Error Count
readErrors=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Read Error Count" | awk '{print $4}')
zabbixKey=$org.esxi.smart.$device.read_errors
zabbixValue=$readErrors
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
#Drive Temperature
driveTemp=$(ssh root@$yourESXiHost esxcli storage core device smart get -d $device | grep "Drive Temperature" | awk '{print $3}')
zabbixKey=$org.esxi.smart.$device.drive_temp
zabbixValue=$driveTemp
/usr/bin/zabbix_sender -vv -z "$zabbixServer" -s "$zabbixName" -k "$zabbixKey" -o "$zabbixValue"
done