The client asked to send SNMP traps to their Nagios server instead of email alerts. The only thing I knew about SNMP until yesterday was that it sounded like an abbreviation, so please excuse (and correct me) any misconceptions I may have.
The only information that should be sent to the trap relates to event data, which we are warning our client about, which is just a couple of values retrieved from our database. Needless to say, this is not in any MIB, and they do not have an OID, and it is here that I have problems finding answers.
I cannot figure out how I want to add our data to the trap without using the OID MIB, which I do not have.
I am using PySNMP to generate the request and have only incomplete code right now, since I'm not sure how to include the inclusion of our data in the package.
from pysnmp.hlapi import *
def sendSNMP(destination, community_string, data):
community = CommunityData(community_string, mpModel = 0)
target = UdpTransportTarget((destination, 162))
notification_type = None
req = sendNotification(SnmpEngine(), community, target, ContextData(), 'trap', notification_type)
errorIndication, errorStatus, errorIndex, varBinds = next(req)
Any help is appreciated! Thanks.
source
share