SNMP Variables in Notifications

Hello,

for SNMP-Devices I would like to add the following variables to the E-Mail Notification.
snmp-server location
snmp-server contact
snmp-server model

But I can’t find these in the Notification configuration.
I can activate “Complete varaible list”, but there aren’t SNMP-Variables

on: <gerhard.xxxt@gmail.com>
Date: Mi., 27. Apr. 2022, 14:21
Subject: Check_MK: 52.95.xxx.xxx - UP -> DOWN
To: <cmk-network@gxxxt.de>

Host	52.95.xxx.xxx (52.95.xxx.xxx)
Event	UP → DOWN
Address	52.95.xxx.xxx
Date / Time	Wed Apr 27 12:19:15 UTC 2022
OMD Site	central
Summary	No IP packet received for 31.136046 s (deadline is 30.000000 s)
Metrics	
Complete variable list	CONTACTALIAS	Network-Admin
CONTACTEMAIL	cmk-network@gdxxx.de

CONTACTNAME	networkadm
CONTACTPAGER	
CONTACTS	networkadm
DATE	2022-04-27
EVENT_HTML	<span class="stateUP">UP</span> &rarr; <span class="stateDOWN">DOWN</span>
EVENT_TXT	UP -> DOWN
HOSTACKAUTHOR	
HOSTACKCOMMENT	
HOSTADDRESS	52.95.xxx.xxx
HOSTALIAS	52.95.xxx.xxx
HOSTATTEMPT	2
HOSTCHECKCOMMAND	check-mk-host-smart
HOSTCONTACTGROUPNAMES	all,Network-Admins
HOSTDOWNTIME	0
HOSTFORURL	52.95.xxx.xxx
HOSTGROUPNAMES	check_mk
HOSTNAME	52.95.xxx.xxx
HOSTNOTES	
HOSTNOTESURL	
HOSTNOTIFICATIONNUMBER	1
HOSTOUTPUT	No IP packet received for 31.136046 s (deadline is 30.000000 s)
HOSTOUTPUT_HTML	No IP packet received for 31.136046 s (deadline is 30.000000 s)
HOSTPERFDATA	
HOSTPROBLEMID	780850
HOSTSHORTSTATE	DOWN
HOSTSTATE	DOWN
HOSTSTATEID	1
HOSTTAGS	/wato/fth/infrastruktur/scan-52_95.xxx. auto-piggyback device_none ip-v4 ip-v4-only no-agent no-snmp os_keines ping site:central test wan
HOSTURL	/check_mk/index.py?start_url=view.py%3Fview_name%3Dhoststatus%26host%3D52.95.xxx.xxx%26site%3Dcentral
HOST_ADDRESS_4	52.95.xxx.xxx
HOST_ADDRESS_6	
HOST_ADDRESS_FAMILY	4
HOST_EC_CONTACT	
HOST_FILENAME	/wato/fth/infrastruktur/scan-52_95.xxx.hosts.mk

HOST_SL	
HOST_TAGS	/wato/fth/infrastruktur/scan-52_95.xxx. auto-piggyback device_none ip-v4 ip-v4-only no-agent no-snmp os_keines ping site:central test wan
LASTHOSTPROBLEMID	780850
LASTHOSTSHORTSTATE	DOWN
LASTHOSTSTATE	DOWN
LASTHOSTSTATECHANGE	1651061623
LASTHOSTSTATECHANGE_REL	0d 00:05:32
LASTHOSTSTATEID	1
LASTHOSTUP	1651061592
LASTHOSTUP_REL	0d 00:06:03
LINKEDHOSTNAME	52.95.xxx.xxx
LINKEDSERVICEDESC	
LOGDIR	/omd/sites/central/var/check_mk/notify
LONGDATETIME	Wed Apr 27 12:19:15 UTC 2022
LONGHOSTOUTPUT	
MAIL_COMMAND	mail -s &#x27;Check_MK: 52.95.xxx.xxx - UP -> DOWN&#x27; &#x27;cmk-network@gxxxt.de&#x27;

MAXHOSTATTEMPTS	2
MICROTIME	1651061955917919
MONITORING_HOST	cma1
NOTIFICATIONAUTHOR	
NOTIFICATIONAUTHORALIAS	
NOTIFICATIONAUTHORNAME	
NOTIFICATIONCOMMENT	
NOTIFICATIONTYPE	PROBLEM
OMD_ROOT	/omd/sites/central
OMD_SITE	central
PARAMETER_ELEMENTSS	omdsite address abstime longoutput perfdata graph context
PARAMETER_ELEMENTS_1	omdsite
PARAMETER_ELEMENTS_2	address
PARAMETER_ELEMENTS_3	abstime
PARAMETER_ELEMENTS_4	longoutput
PARAMETER_ELEMENTS_5	perfdata
PARAMETER_ELEMENTS_6	graph
PARAMETER_ELEMENTS_7	context
PARAMETER_GRAPHS_PER_NOTIFICATION	5
PARAMETER_NOTIFICATIONS_WITH_GRAPHS	5
PREVIOUSHOSTHARDSHORTSTATE	UP
PREVIOUSHOSTHARDSTATE	UP
PREVIOUSHOSTHARDSTATEID	0
SHORTDATETIME	2022-04-27 12:19:15
SUBJECT	Check_MK: 52.95.xxx.xxx - UP -> DOWN
WHAT	HOST

any idea how can add these SNMP variables to E-Mail notification ?

thanks

CheckMK (and Nagios) does not store this data in a way that the notifications can use it.

The only service checks that displays it is “SNMP Info”. You would need to add a livestatus query to the notification plugin to fetch that data.

Thanks for your information, so it seems there is no easy way to get the information.

We have many locations with a lot of switches and with our other monitoring tool (WhatsUp Gold)
there is an easy way to add these information to the notifiation (%Device.Attribute.*)

CheckMK also collects such information in its Hardware/Software inventory.

But currently it is not easily available for notifications. Could be a feature request.

As you wrote it is a device attribute inside WhatsUp Gold. That means, it is some type of saved configuration attribute. That WhatsUp automatically stores it, is something else. Inside CMK you can reach a similar behavior with using the inventory data mentioned by @r.sander and use some script to write these information in some own defined host attributes. These attributes later can be used in the notification similar to your example from WhatsUp.

Device → HW/SW inventory → Script → Custom Host attribute → Notification

I have one system where the location data comes not from the device itself but from a CMDB and i handled it with the custom attributes.

1 Like

Thanks Andreas, I will try to realize it in Checkmk.

In WhatsUp we can use the following information stored in variables.
We haven’t configured these attributes in Whatsup, they come definitely from SNMP configured devices

Device.Attribute.Contact=Systems Business Services
Device.Attribute.Description=Cisco IOS Software, C2960X Software (C2960X-UNIVERSALK9-M), Version 15.2(7)E2, RELEASE SOFTWARE (fc3) Technical Support: Support - Cisco Support and Downloads – Documentation, Tools, Cases - Cisco Copyright (c) 1986-2020 by Cisco Systems, Inc. Compiled Sat 14-Mar-20 16:53 by prod_rel_team
Device.Attribute.FwVersion=15.2(7)E2
Device.Attribute.HwVersion=B0
Device.Attribute.Location=Publications Bremen
Device.Attribute.MACAddress=6C:FA:89:xx:xx:xx
Device.Attribute.MACAddressVendor=Cisco Systems Inc.
Device.Attribute.Model=WS-C2960X-24TS-L
Device.Attribute.Name=SX4097P-2960X.domain.de
Device.Attribute.SerialNumber=FCW1817X16X
Device.Attribute.SwVersion=15.2(7)E2
Device.Attribute.Vendor=Cisco
Device.Attribute.Vendor_OS=
Device.Attribute.Vendor_OSVersion=

All this information is available in CheckMK’s HW/SW inventory.
The part missing as @andreas-doehler wrote is the script that puts this into custom host attributes which can be used for notifications. But the notification plugin also has to be modified. Unfortunately there is currently no generic way for using such kind of info from the device.

Could be an interesting feature, @martin.hirschvogel

2 Likes

is there a chance to get this feature in a future release ?

thx

@gdx need the same feature. Did you realise something in the past what you would like to share? If not, what about the feature request? @martin.hirschvogel

br
Dennis

You can create feature requests yourself on features.checkmk.com

1 Like

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.