yiyiwa
2015-04-26 15:41:10 +08:00
你这个参数我没监控过, 我现在有的监控硬盘的SMART状态, 因为我的ESXi是组装的服务器,然后有的信息没办法查看, 于是用RUBY写了一个脚本. 定时SSH到ESXi 查询相关信息,脚本如下:
#!/usr/bin/ruby
require 'net/ssh'
require 'net/telnet'
#0 ok; 1 warning; 2 critical; 3 unknown
user, pass = "root", "123"
def test(ip,user,pass)
begin
Net::SSH.start(ip, user, :password => pass ) { |ssh|
result = ssh.exec!('for i in `esxcli storage core device list | grep "Local ATA Disk" | sed "s/.*(\|)//g"`; do esxcli storage core device smart get -d "$i" | grep Health ; done')
}
rescue
end
end
status = test('192.168.1.22',user,pass)
if status.scan("OK").count == status.scan("Health").count
puts "Disk Smart OK"
exit 0
else
puts "Disk Smart Fail"
exit 2
end