Created
September 28, 2020 23:53
-
-
Save callumbrieske/4e47a060a96c13e5ef43d0c7f18f9fc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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