How to create a customer plugin via mib file

Hello,

If got a question and hopefully somebody can help me with this.
I got a device where I can connect some sensors (temperature, humidity, movement sensor etc)
This device allowed to get the information by SNMP.
I’ve got a mib file, is there an option to upload a mib file?
Or do I need to create new plugin?

thank you in advance

You can “upload” your mib file but only to use it to rewrite SNMP traps.

Yes you need to create a plugin with the data you can get from the mib file.

Thank you Andreas.

I create a plugin in the directory (/omd/sites/monitoring/local/share/check_mk/agents/plugins)

#!/bin/bash

SNMPv3 credentials

readonly IP=“192.168.178.240”
readonly PORT=“161”
readonly ENGINE_ID=“80001f88800044843b98b6bc56”
readonly USER=“Test”
readonly AUTH_PROTOCOL=“MD5”
readonly AUTH_PASSWORD=“Test1234567890!!?”
readonly PRIV_PROTOCOL=“AES”
readonly PRIV_PASSWORD=“Test1234567890!!?”

SNMP OID for apOneWireType

readonly OID_TYPE=“.1.3.6.1.4.1.43307.2.1.1.7.1.3.0”

SNMP OID for apOneWireValue

readonly OID_VALUE=“.1.3.6.1.4.1.43307.2.1.1.7.1.4.0”

Fetch the value for apOneWireType

type_value=$(snmpget -v3 -l authPriv -u “$USER” -a “$AUTH_PROTOCOL” -A “$AUTH_PASSWORD” -x “$PRIV_PROTOCOL” -X “$PRIV_PASSWORD” -n “$CONTEXT_NAME” -e “$ENGINE_ID” “$IP:$PORT” “$OID_TYPE” | awk -F": " '{pri>

Fetch the value for apOneWireValue

value_value=$(snmpget -v3 -l authPriv -u “$USER” -a “$AUTH_PROTOCOL” -A “$AUTH_PASSWORD” -x “$PRIV_PROTOCOL” -X “$PRIV_PASSWORD” -n “$CONTEXT_NAME” -e “$ENGINE_ID” “$IP:$PORT” “$OID_VALUE” | awk -F": " '{p>

echo “apOneWireType: $type_value”
echo “apOneWireValue: $value_value”

When I execute the script I received the information:
ipadmin@checkmk:/omd/sites/monitoring/local/share/check_mk/agents/plugins$ ./apOneWireNumber.mk
apOneWireType: “temp”
apOneWireValue: “24.843”

Is it posible to show values in a CheckMK dashboard? (Checkmk Raw Edition 2.1.0p26)

I do not see the possibility how to get this information in a dashboard.

Thanks in advance

Hi Patrick,

Please use the preformatted text format for code for better readability. You can do that by highlighting the text, then pressing Ctrl+E.

Regarding your plugin - that’s not quite how check plugins work: there is a very good overview in the docs: Writing your own check plug-ins

If your check really only needs to pull values and display them, I suggest you use: Checkmk Exchange

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.