Skip to content

Instantly share code, notes, and snippets.

@scr512
Created September 18, 2013 15:51
Show Gist options
  • Save scr512/6611228 to your computer and use it in GitHub Desktop.
Save scr512/6611228 to your computer and use it in GitHub Desktop.
Dashing job using SNMP queries to get a NetApp filer's general health.
require 'snmp'
NetApp_DataO = Array.new
SNMP::Manager.open(:Host => 'netapp-filer.local', :Version => :SNMPv1, :Community => 'public') do |manager|
manager.load_module("NETAPP-MIB")
response = manager.get(["miscGlobalStatus.0",
"miscGlobalStatusMessage.0"])
response.each_varbind do |varbind|
NetApp_DataO.push(varbind.value.to_s)
end
end
if NetApp_DataO[0] == "1" then
status = "other"
elsif NetApp_DataO[0] == "2" then
status = "unknown"
elsif NetApp_DataO[0] == "3" then
status = "ok"
elsif NetApp_DataO[0] == "4" then
status = "NonCritical"
elsif NetApp_DataO[0] == "5" then
status = "Critical"
elsif NetApp_DataO[0] == "6" then
status = "NonRecoverable"
end
SCHEDULER.every '15s' do
send_event('netapp-health', { text: status })
send_event('netapp-health', { moreinfo: NetApp_DataO[1] })
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment