Help on using a SNMP-based plugin

Hello guys,

I’ve been trying to extract one service from one of my host via and OID

(in my case, dynamic OID, explaining the need to write a snmp plugin that checks based on a name and a base OID).

For this i’ve created a python file which i moved into /omd/sites/mysite/local/lib/python3/cmk/base/plugins/agent_based

My initial issue was that the file would dissapear. I’ve read that this is because i am working on a checkMK satellite which is not the master.

Now that i have rights on the master checkMK as well, even if i put the file in the same place on the master, obviously my satellite checkMK will not see the file and not check the service.

Can anyone help me with that ? where am i supposed to put the file ?

For info: working on checkmk V2.1.0

Regards,

The paths looks ok. The push of the file will afik only take place on the activation of a configuration change. It might be better to create a second site on the satellite for development When you have finished developing your plugin, create an MKP file and place it on the master site. The next time you activate a config change, it will be transferred to the satellite sites.

Developing a Checkmk extension should always be done on a dedicated site, not your production system.

BTW: If you only want to query one OID we got you covered:

https://exchange.checkmk.com/p/check-snmp

https://exchange.checkmk.com/p/check-snmp-metric

There is no mention to MKP file in the official tutorial for snmp check plugins: Writing SNMP-based check plug-ins

Thanks, but does this work for a dynamic OID ?
i’ve noticed the service i want to monitor changes oid at every restart.

How? Did the producer of the device not understand SNMP?

Maybe i didn’t get this right, but doing a snmpwalk shows that at least.

The last part of the OID changes (going from like 1.3.6.1.4.2.1.56235 to 1.3.6.1.4.2.1.85326 for example).

Is there another OID list that has a unique identifier for the item you want to monitor and they match on the last number of the OIDs?

I just noticed there is another OID from the same process that ends with the same numbers indeed.

here you should find everything about MKPs :wink:

You need to use a unique identifier for the item in your check. It needs to be cross referenced from the other list.

You can use OIDEnd() to get the last number of the OID into the string_table for your parse function to be able to cross reference the values.

An example can be found here: check_mk_extensions/acgateway/lib/check_mk/base/plugins/agent_based/acgateway_sipinterface.py at cmk2.3 · HeinleinSupport/check_mk_extensions · GitHub

could you specify what exactly you want to monitor? You talked about a process. So maybe there is already something available to serve your needs.

Web server service

Isn’t out there just an option to search for a snmp process just by his name ? It would bu much simplier

Yes, there is. Just use the rule “Process discovery” to specify which processes to create a service for. There you can also specify a whole bunch of metric levels to check.

Seems to be working but the status details isn’t showing anything really useful, is it possible to change that ?

Hi. Activate the service and see what metrics there are. You will not see it till you have the service active.

Hi, the service is already active. tried turning it off and it is still “ok” in checkmk.

There is also an nginx_status agent plugin that can be deployed to the host.

If it is ok or not depends on the levels you define either in process discovery (changes there require to remove and re-add the service as they are some kind of “defaults”) or by using the rule " State and count of processes" to modify the levels after discovery.