Smnp oid and checkmk

Hi there

I’ve searched, I don’t understand… and I think my misunderstanding is more related to the operation of SNMP than anything else… I’ll explain.

When i type this command on cli in my checkmk server

snmpwalk  -v 1 -c public 192.168.8.249 .1.3.6.1.4.1.2.3.51.3.1.13.1.7.1.4

I have the good return (a RAID Status)

But when I enter in CheckMK exactly the same OID, the message is :

SNMP CRITICAL - No Such Object available on this agent at this OID

I have created the check in Setup > Services > Other services > Check SNMP OID

Can someone explain me what I am doing wrong ?

Thanks

Vincent

What’s your intent do do this? More informations will be helpful.

Rg, Christian

Hi @ChristianM

in this case, my goal is to retrieve the state of the raid cluster.
Indeed, the automatic discovery of the host in SNMP did not give much. For example, I have nothing on the RAID or on the state of the disks.
that’s why I’m looking to retrieve the information by directly querying the device OIDs.

Vincent

In this case, you need to write a check for Raid information.
Here the example based on qnap raid:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
QNAP QTS Raid Status
"""

from .agent_based_api.v1 import *


def parse_qnap_qtsraid(string_table):
    parsed = []
    for name, status, cap, lv in string_table[0]:
        data = [name, status, int(cap), int(lv)]
        parsed.append(data)
    return parsed

register.snmp_section(
    name="qnap_qtsraid",
    parse_function=parse_qnap_qtsraid,
    fetch=[
        SNMPTree(
            # .iso.org.dod.internet.private.enterprises.qnap.qts.storage.diskTable.diskTableEntry.3 = name
            # .iso.org.dod.internet.private.enterprises.qnap.qts.storage.diskTable.diskTableEntry.4 = status
            # .iso.org.dod.internet.private.enterprises.qnap.qts.storage.diskTable.diskTableEntry.5 = capacity
            # .iso.org.dod.internet.private.enterprises.qnap.qts.storage.diskTable.diskTableEntry.7 = level
            base=".1.3.6.1.4.1.55062.1.10.5.1",
            oids=[
                '3', # raid name
                '4', # raid status
                '5', # raid capacity
                '7', # raid level
            ]

        )
    ],
    detect=exists(".1.3.6.1.4.1.55062.1.10.2.1.1.1"),
)

def discover_qnap_qtsraid(section):
    for name, status, cap, lv in section:
        yield Service(item=name)


def check_qnap_qtsraid(item, params, section):
    state = State.OK
    for name, status, cap, lv in section:
        if name == item:
            infotext = f"Status: {status}; Raid level: {lv}"
            if status != "Ready":
                state = State.CRIT
            yield Result(state=state, summary=infotext)
            yield Metric("fs_used", cap)


register.check_plugin(
    name="qnap_qtsraid",
    service_name="QNAP Raid %s",
    discovery_function=discover_qnap_qtsraid,
    check_function=check_qnap_qtsraid,
    check_default_parameters={},
)

You need to place your own checks in “~/local/lib/check_mk/base/plugins/agent_based”. More information in the manuals.

Rg, Christian

I don’t have Check SNMP OID, possibly not available for raw.

Maybe you can use Setup | Services | Other services | Integrate Nagios plugins instead.

Example rule for showing model of my printers:

So yours might be:

check_snmp -H 192.168.8.249 -o 1.3.6.1.4.1.2.3.51.3.1.13.1.7.1.4 -P 1 -C public

I’m using the latest Enterprise edition and I don’t have that either. Anyway, for single OIDs, using check_snmp is often the simplest solution.

1 Like

Hi @ChristianM

I am surprised… checkmk does not detect raid status for QNAP NAS ?
i do it well for synology NAS…
but perhaps it is the same than for my raid status for my Lenovo IMM…

By the Way, thanks for reply.
I will try this today.

Vincent

That’s why I wrote this extension :wink:

Hi @Yggy

Thanks for the solution… but I play with bad luck (i don’t know if this expression exist in english)…
I did exactly what you told and… I have a warning…

It seems to be a known bug But my checkmk version is a fresh install in the latest version…

Well i guess I have to dive back into the study of python to do a check as I wish…

@ChristianM Is there a reason why you made a script instead of using the check_snmp command as suggested by Yggy ?

The reason to use the checkAPI is, you have more options to extend your monitoring and you can do much more things with the data. You will also be able to set thresholds via WATO.

Rg, Christian

1 Like

Wild assumptions…

In your original commandline you used snmpwalk

Man page tells the following:

snmpwalk is an SNMP application that uses SNMP GETNEXT requests to query a network entity for a tree of information.

An object identifier (OID) may be given on the command line. This OID specifies which portion of the object identifier space will be searched using GETNEXT requests. All variables in the subtree below the given OID are queried and their values presented to the user.

So maybe your OID is not an endpoint, but a starting point where sub ids can be found.
Assuming that with that OID the response is an array instead of a string what is expected for check_snmp.

If so, find an end point OID of the information you look for.
The way I found mine: in the host view of the device, you can download the SNMP walk and open it in text editor to find the specific OID by value. Compared values with values from SNMP interface view of device self to be sure.
image

Hi,
Have you tried deleting first point in OID in the service parameters??
1.3.6.1.4.1.2.3.51.3.1.13.1.7.1.4 instead of .1.3.6.1.4.1.2.3.51.3.1.13.1.7.1.4

Hi @jortola

I have already test without success… (
in fact, since I never know whether or not to have this damn point to start with, I always test both

Vincent
(sorry to be late)

Hi @Yggy And sorry to be late…

I don’t remember to be notified for your post… and since I was testing checkmk with some of my clients without informing my hierarchy, I didn’t come to the forum every day.
but now i’m out of the shadows and i’m being asked to test a lot more checkmk… so i should be less lengthy in my answers…
I am going to try a tell you what’s happen.

Thanks

No need to be sorry.
Some people have to work and/or don’t want to monitor the forum 24/7. :wink:

Hmmm, thinking of it now…
Is there a specific check in Checkmk for monitoring the forum actually?! :thinking: :laughing:

Forum is monitored 24/7 by Checkmk :sunglasses:

2 Likes