×
Back to OP5 Monitor FAQ
Handler to receive Interface up/down traps from HP switches
This procedure is unsupported Copied
Articles in the “Unsupported Community Documents” space are not supported by ITRS support.
Version Copied
This article was written for version 2.1 of Trapper. It could work on both lower and higher versions if nothing else is stated.
Demo handler for snmp traps from HP switches. Tested with a ProCurve 2520G-8-Port / J9298A.
handler-hp-linkstatus.lua Expand source
-- loglog("caught a trap from host: " .. result.host)
-- dump the trap into logs (to view it in SNMP traps gui) for debugging purposes
-- dump.trap()
-- update passive service check even if there is no state change (useful for keepalive traps)
-- result.notify = NOTIFY.ALWAYS
-- set the restresult.service = "Interface status"
for k, v in pairs(trap.fields) do
if string.match(k,'^\.1\.3\.6\.1\.2\.1\.16\.9\.1\.1\.2\.76$') then
local message = v
local portname = string.match(message, "port [0-9]+")
log('Trap severity is CRITICAL, port is ' .. portname)
result.tag = portname
result.message = "HP switch port " .. portname .. " is in CRITICAL state"
result.state = STATE.CRITICAL
elseif string.match(k,'^\.1\.3\.6\.1\.2\.1\.16\.9\.1\.1\.2\.75$') then
local message = v
local portname = string.match(message, "port [0-9]+")
log('Trap severity is OK, port is ' .. portname)
result.tag = portname
result.message = "HP switch port " .. portname .. " is in OK state"
result.state = STATE.OK
else
log('something else happened')
local message = v
result.message = message
end
end
["Geneos"]
["FAQ"]