SNMPv3 context not applied to snmpget (HP printer, context Jetdirect)

CMK version:
CheckMK 2.4.0p5 raw edition

OS version:
Ubuntu 24.04.2 LTS

Error message:

Output of “cmk --debug -vvn hostname”:

OMD[site]:~$ cmk --debug -vvvvvI hostname
Discovering services and host labels on: hostname
hostname:
+ FETCHING DATA
  Source: SourceInfo(hostname='hostname', ipaddress='10.10.10.10', ident='snmp', fetcher_type=<FetcherType.SNMP: 7>, source_type=<SourceType.HOST: 1>)
[cpu_tracking] Start [7e6fdb5fdb80]
Read from cache: SNMPFileCache(path_template=/omd/sites/site/tmp/check_mk/data_source_cache/snmp/{mode}/hostname, max_age=MaxAge(checking=0, discovery=90.0, inventory=90.0), simulation=False, use_only_cache=False, file_cache_mode=1)
  SNMP scan:
       Getting OID .1.3.6.1.2.1.1.1.0...
Running 'snmpget -v3 -l authPriv -a sha -u redacted -A redacted -x AES -X redacted -m "" -M "" -On -OQ -Oe -Ot 10.10.10.10 .1.3.6.1.2.1.1.1.0'
ERROR: SNMP error: snmpget: Bad context specified
       Getting OID .1.3.6.1.2.1.1.1.0 failed.

Hi,

When using SNMPv3 contexts configured in Checkmk, the context isn’t being applied to snmpget calls. If I hardcode the context (e.g., -n Jetdirect) in lib/python3/cmk/fetchers/snmp_backend/classic.py, the snmpget command succeeds and retrieves the correct data. Subsequent snmpbulkwalk calls then correctly pick up and apply the context from the Checkmk configuration. It appears that snmpget is ignoring the configured SNMPv3 context. Is this a bug, or am I missing something?

Hi Slano,
yes this is a bug and I’m currently working on a fix.

But there are two known partial workarounds:

  1. Use SNMPv2
  2. Add a “Hosts without system description OID” rule (this will only provide the most basic information, see: [Check_mk (deutsch)] SNMPv3 Context mit HP Drucker - #3 by dcf5ecae3f27d2ce)

I’ll post a link to the werk once the fix is ready.

Have a nice day
Andreas

1 Like

Good news. The fix has passed reviews and will be available to all maintained versions of Checkmk.

For more details see Werk #18341: snmplib: Always use SNMPv3 contexts in requests

2 Likes

Perfect, thanks a lot for the info as well as the fix!

Hello!

If one of the answers helped you solve your question, please mark it as the solution. This way, you thank the person who helped you and also indicate that the question has been resolved. This, in turn, helps others who come across the same question.

Solution

Thank you!

1 Like