Skip to content

Instantly share code, notes, and snippets.

@callumbrieske
Created September 28, 2020 23:53
Show Gist options
  • Save callumbrieske/4e47a060a96c13e5ef43d0c7f18f9fc2 to your computer and use it in GitHub Desktop.
Save callumbrieske/4e47a060a96c13e5ef43d0c7f18f9fc2 to your computer and use it in GitHub Desktop.
thisCoreSNMP = SNMPSession.New(SNMP.SessionType.V2c)
thisCoreSNMP:setHostName(Network.Interfaces()[1].Address)
thisCoreSNMP:setCommunity("public")
thisCoreSNMP:startSession()
function mySNMPCallback(response)
if response.Error then
error(("There was an SNMP error: %s"):format(d.Error))
else
if response.OID == "iso.3.6.1.4.1.1536.1.1.2.1.0" then
print(("System firmware major version: %s"):format(response.Value))
elseif response.OID == "iso.3.6.1.4.1.1536.1.1.2.2.0" then
print(("System firmware minor version: %s"):format(response.Value))
elseif response.OID == "iso.3.6.1.4.1.1536.1.1.2.3.0" then
print(("System firmware build version: %s"):format(response.Value))
end
end
end
thisCoreSNMP.EventHandler = mySNMPCallback
thisCoreSNMP.ErrorHandler = mySNMPCallback
function getFirmwareInfo()
thisCoreSNMP:getRequest("iso.3.6.1.4.1.1536.1.1.2.1.0")
thisCoreSNMP:getRequest("iso.3.6.1.4.1.1536.1.1.2.2.0")
thisCoreSNMP:getRequest("iso.3.6.1.4.1.1536.1.1.2.3.0")
end
getFirmwareInfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment