Custom SNMP check

Hello,

I am trying to write custom SNMP check. I read the article about this but still I cannot do it.

Basically what I have to do. I have a host named = radius1, which uses agent and snmp. I created second host = radius1-joro-test. Both hosts have one and the same ip address, but I configured radius1-joro-test to communicate with the other server on UDP port - 163. I receive the needed OIDs and the SNMP info service is created.

I started writing 1st of 5 SNMP custom checks.
The 1st check have to sum the values that belongs to these OIDs.

AuthResponses = .1.3.6.1.2.1.67.1.1.1.1.8.0 + .1.3.6.1.2.1.67.1.1.1.1.9.0 + .1.3.6.1.2.1.67.1.1.1.1.10.0
AuthResponses = 3026606 + 14908 + 0 - test values

I wrote really based check, just to test if I will manage to visualize it in radius1-joro-test.
My check:

#!/user/bin/env python

-- encoding: utf-8; py-indent-offset: 2 --

def inventory_auth(info):
#auth = []
#for a in info:
# auth.append(a)
print info
return []

def check_auth(item, params, info):
#auth_responses = “.1.3.6.1.2.1.67.1.1.1.1.8.0” + “.1.3.6.1.2.1.67.1.1.1.1.9.0” + “.1.3.6.1.2.1.67.1.1.1.1.10.0”
#i = item
#in = info
#print i
#print in
return (3, “UNKNOWN - not yet implemented”)

check_info[“auth_responses”] = {
“check_function” : check_auth,
“inventory_function” : inventory_auth,
“service_description” : “AuthResponses”,
“snmp_info” : ( “.1.3.6.1.2.1.67.1.1.1.1”, [ “8”, “9”, “10” ] ),
“snmp_scan_function” : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.2.1.67."),
“has_perfdata” : True,
“group” : “auth_responses”,
}

When I test it from the console, I get:
[[u’3150833’, u’15193’, u’0’]]

When I go to the GUI I do not see it. Instead of single service for that check I see that the data is appended into Status Detail of the service - Check_MK Discovery.

I read that all of the checks stored in /omd/sites/<>/local/share/check_mk/checks are ran for every host and using snmp_scan_function can be specified to which host exactly we want to attach the check.

Can you help me to visualize the custom check and append it to specific host?

I am using Check Mk Raw Version 1.6.0p6.

Best Regards,
Georgi Bozhinov

Hi,

I used help from a friend and managed to make it work.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.