How to monitor snmp on a host in a different network

I have a host I want to monitor via SNMP. The checkmk server can not reach this server directly, but I have another linux server from where I can snmpwalk.
Is it possible to “redirect” the SNMP output to checkmk or is there another possibility to send the data to checkmk?

Hi @havefun,

at the moment, not that easily. There are thoughts about building a sort of snmp proxy fetcher, but that’s nothing you can test yet.

I think you have 2 possibilites:

  1. forward the snmp traffic over the linux host (untested, but it seems ssh can also tunnel snmp udp traffic Tunnel snmp-check and other UDP traffic over SSH)
  2. have the linux host collect an snmpwalk and transfer that to your site’s ~/var/check_mk/snmpwalks/<hostname_of_snmp_device> and set that device to use the rule “Simulating SNMP by using a stored SNMP walk” (note: this creates possibly a lot of load on the snmp device, as a full snmpwalk is sometimes way more snmp queries than what checkmk needs.)
    to have “snmpwalk” output the data in the way checkmk expects it, my notes say the parameters are:
snmpwalk -Oqeun -v 2c --hexOutputLength=0 -c public $ip .1

(a few years ago, I had to do this over an AIX system, so the full script looked like this:

#!/bin/bash
# $1 = linux/aix host able to connect to 
# $2 = device ip you actually want to monitor
# $3 = hostname of $2 within checkmk
filepath=~/var/check_mk/snmpwalks/$3
tmp_path=~/var/check_mk/snmpwalks/$3.tmp
ssh checkmk_user@$1 "/opt/freeware/bin/snmpwalk -Oqeun -v 2c --hexOutputLength=0 -c public $2 .1" | grep -vE '^"$' > $tmp_path
iconv -c -t UTF-8 < $tmp_path > $filepath 
# iconv command taken from https://unix.stackexchange.com/a/6517
# necessary starting with checkmk 2.0.0 and python3 which expects clean utf-8 input from the walks
#no error handling done here, check_mk takes care of that```
4 Likes

Maybe installing an additional CheckMK instance on the remote linux server and using Distributed Monitoring would be an option?

1 Like