liveaverage / check_mk_bag

Collection of in-house Check_MK plugins, many for generic data center or network closet hardware that's missing from native checks.
1 stars 2 forks source link

More of a question than an issue - Where do we put these scripts? #1

Open greavette opened 8 years ago

greavette commented 8 years ago

Hello,

Very impressive list of plugins you have here. I'm very new to using check_mk (actually I'm using OMD which has check_mk installed) so I apologize up front for asking what is probably an easy question.

Where do I put these plugins to make this work? I'm assuming these on the monitoring server itself. In my case I'm very interested in your RoomAlert script and I don't think we're able to connnect to the RoomAlert and place any scripts on the unit itself.

Any advice or pointers you can give me would be greatly appreciated.

Thank you.

liveaverage commented 8 years ago

Hi greavette,

For OMD, just copy the check or checks directly to /opt/omd/sites/{yourOMDsite}/share/check_mk/checks -- you're correct, these just need to be on the monitoring server. I had a colleague request the RoomAlert a while back ;-) I'm about to add a couple more I just created for NetBotz Temperature, Humidity, and Dewpoint. Let me know if you have any issues or other questions!

Thanks,

JR

liveaverage commented 8 years ago

Errr... Looks like I wrote this one a while back, and things have changed slightly in Check_MK -- they have an available _checktemperature() function that allows setting temperature parameters via WATO. I'll try to rewrite this one tonight so it uses temperature.include, but the existing check will work fine, too.

greavette commented 8 years ago

Great information JR..thanks very much for the replies.

I actually don't use the 4e room alert. We have a 32W in our small office. Using the iReasoning MIB Browser I don't think the 32W has the same OID that you used (but I'm still learning how to use MIB and OID with SNMP) but I may be mistaken...I'll take what you've created and modify it to suit our needs....thanks again for making it available.

As for using WATO to set temperature parameters...do you mean though Rulesets?

liveaverage commented 8 years ago

If you need any help tailoring it for the 32W model, just let me know.

Yep, correct on the WATO temperature settings -- you can configure upper & lower levels via WATO (Host & Service Parameters > Temperature, Humidity, Electrical Parameters, etc. > Temperature). In order for these ruleset values to apply to your check, you'll need to use correct "group" ('group': 'room_temperature',) and the _checktemperature() function (for consistency) provided by Check_MK -- this also makes it easier on you! I uploaded my recent NetBotz checks that use this method:

https://github.com/liveaverage/check_mk_bag/blob/master/apc_netbotz_temp

Again, just let me know if you need help with creating a 32W check!

greavette commented 8 years ago

Wow! Thanks very much for the offer of assistance. I would really like to better understand how to create the 32W plugin so I can build more plugins for OMD/check_mk. Perhaps you can point me in the right direction here then....

I'm reading through your python script. Must admit here I don't know python. Is there a tutorial I can take on how to build a check_mk python script that would be useful perhaps?

I see in your script you have ".1.3.6.1.4.1.20916.1.6.1.2.1". I'm assuming this is specific to the 4e Room Alert. What do I look for to find the number used by the 32W? I have iReasoning installed to assist me. Any pointers you can give me?

Thank you.

liveaverage commented 8 years ago

Geez - I had browsed to these pages specifically to provide some docs, and I forgot to include them! Sorry! Try these:

https://mathias-kettner.com/checkmk_devel_guidelines.html https://mathias-kettner.de/checkmk_devel_snmpbased.html https://mathias-kettner.de/checkmk_devel_snmpscan.html

Since I couldn't publicly browse the MIB's for the 32W, I couldn't find the base OIDs for internal/external sensors -- I'd expect they're the same for 32W & 4e, but I might be wrong.

Using https://github.com/liveaverage/check_mk_bag/blob/master/apc_netbotz_temp as an example: What you'll want to look for is the internal/external sensor "base" OID (you can see my sample snmpwalk in the check file using .1.3.6.1.4.1.5528.100.4.1.1). You're really just trying to locate the sensor "table". Once that's located it's a bit of plug-and-play. The two lines in the CMK check you'll be focusing on:

'snmp_info':               ('.1.3.6.1.4.1.5528.100.4.1.1.1', ['4', '8']),
 'snmp_scan_function':      lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5528.100.20.10."),

snmp_info just tells the check to examine that "table" at base OID .1.3.6.1.4.1.5528.100.4.1.1.1, which happens to be Temperature sensors connected to the NetBotz. The ['4','8'] variable says to looks at that same table, but more specifically at OID .4, which corresponds to the sensors name, and OID .8, which corresponds to the value -- think of these as table "columns". This array of information is stored in the info variable (automagically by Check_MK), and then passed to the _check_apctemp function, which looks at each name & temp value in the info variable, checks it with the built-in _checktemperature function, and returns the results to Nagios/Livestatus.

The snmp_scan_function is what identifies the check compatibility with a specific device. When running a service inventory, if the function returns true, then the service check is added to that specific device. The docs definitely explain this better than I do :)

It's easier to browse the device's SNMP tables with MIBs installed, but it can be done with trial & error, too. I try moving from most specific to least specific OIDs using snmpwalk. So try:

Hope this helps!

JR