openBSD agent does not work correctly in 2.1

CMK version:

2.1.0p6 RAW

OS version:

OpenBSD7.1

Error message:

After the upgrade to 2.1 from 2.0(both the agent and monitor server). He can’t monitor the network interface correctly:

Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

Checkmk version 2.1.0p6
Try license usage history update.
Trying to acquire lock on /omd/sites/REDACTED/var/check_mk/license_usage/next_run
Got lock on /omd/sites/REDACTED/var/check_mk/license_usage/next_run
Trying to acquire lock on /omd/sites/REDACTED/var/check_mk/license_usage/history.json
Got lock on /omd/sites/REDACTED/var/check_mk/license_usage/history.json
Next run time has not been reached yet. Abort.
Releasing lock on /omd/sites/REDACTED/var/check_mk/license_usage/history.json
Released lock on /omd/sites/REDACTED/var/check_mk/license_usage/history.json
Releasing lock on /omd/sites/REDACTED/var/check_mk/license_usage/next_run
Released lock on /omd/sites/REDACTED/var/check_mk/license_usage/next_run
+ FETCHING DATA
  Source: SourceType.HOST/FetcherType.PIGGYBACK
[cpu_tracking] Start [7f230bc17e80]
[PiggybackFetcher] Fetch with cache settings: NoCache(hostname, base_path=/omd/sites/REDACTED/tmp/check_mk/data_source_cache/piggyback, max_age=MaxAge(checking=0, discovery=120, inventory=120), disabled=True, use_outdated=False, simulation=False)
Not using cache (Cache usage disabled)
[PiggybackFetcher] Execute data source
No piggyback files for 'hostname'. Skip processing.
Piggyback file '/omd/sites/REDACTED/tmp/check_mk/piggyback/ntp.REDACTED.lan/vcsa.REDACTED.nl': Successfully processed from source 'vcsa.REDACTED.nl'
Not using cache (Cache usage disabled)
[cpu_tracking] Stop [7f230bc17e80 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.0))]
+ PARSE FETCHER RESULTS
  Source: SourceType.HOST/FetcherType.PIGGYBACK
<<<esx_vsphere_vm:cached(1658154148,90)>>> / Transition NOOPParser -> HostSectionParser
<<<labels:sep(0)>>> / Transition HostSectionParser -> HostSectionParser
No persisted sections
  -> Add sections: ['esx_vsphere_vm', 'labels']
Received no piggyback data
[cpu_tracking] Start [7f230bbeb8b0]
value store: synchronizing
Trying to acquire lock on /omd/sites/REDACTED/tmp/check_mk/counters/hostname
Got lock on /omd/sites/REDACTED/tmp/check_mk/counters/hostname
value store: loading from disk
Releasing lock on /omd/sites/REDACTED/tmp/check_mk/counters/hostname
Released lock on /omd/sites/REDACTED/tmp/check_mk/counters/hostname
No piggyback files for 'hostname'. Skip processing.
Piggyback file '/omd/sites/REDACTED/tmp/check_mk/piggyback/ntp.REDACTED.lan/vcsa.REDACTED.nl': Successfully processed from source 'vcsa.REDACTED.nl'
[cpu_tracking] Stop [7f230bbeb8b0 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.010000001639127731))]
[piggyback] Successfully processed from source 'vcsa.REDACTED.nl', execution time 0.0 sec | execution_time=0.010 user_time=0.000 system_time=0.000 children_user_time=0.000 children_system_time=0.000 cmk_time_agent=0.00

** RAW output of the check_mk_agent **

<<<check_mk>>>
Version: 2.1.0p6
AgentOS: openbsd
Hostname: ntp.REDACTED.lan
AgentDirectory: /etc
DataDirectory:
SpoolDirectory:
PluginsDirectory: /usr/lib/check_mk_agent/plugins
LocalDirectory: /usr/lib/check_mk_agent/local
<<<df>>>
/dev/sd0a ffs       1198894     118560     1020390    10%   /
/dev/sd0e ffs       2061054        722     1957280     0%   /home
/dev/sd0d ffs       3093230    1911310     1027260    65%   /usr
<<<ps>>>
(root,636,100,0.0) /sbin/init
(root,984,24,0.0) /sbin/slaacd
(_slaacd,984,24,0.0) slaacd: engine (slaacd)
(_slaacd,1000,24,0.0) slaacd: frontend (slaacd)
(root,1020,24,0.0) /sbin/dhcpleased
(_dhcp,1020,24,0.0) dhcpleased: engine (dhcpleased)
(_dhcp,1040,24,0.0) dhcpleased: frontend (dhcpleased)
(root,228,8,0.0) /sbin/resolvd
(root,740,768,0.0) syslogd: [priv] (syslogd)
(_syslogd,1236,1320,0.0) /usr/sbin/syslogd
(root,980,216,0.0) pflogd: [priv] (pflogd)
(_pflogd,1020,288,0.0) pflogd: [running] -s 160 -i pflog0 -f /var/log/pflog
(_ntp,1364,1680,0.0) ntpd: ntp engine (ntpd)
(_ntp,940,1164,0.0) ntpd: dns engine (ntpd)
(root,1196,1596,0.0) /usr/sbin/ntpd
(root,1136,1292,0.0) sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups
(root,1728,1536,0.0) /usr/sbin/smtpd
(_smtpd,1464,24,0.0) smtpd: crypto (smtpd)
(_smtpd,1728,1524,0.0) smtpd: control (smtpd)
(_smtpd,1548,1876,0.0) smtpd: lookup (smtpd)
(_smtpd,2104,2096,0.0) smtpd: dispatcher (smtpd)
(_smtpq,1676,1768,0.0) smtpd: queue (smtpd)
(_smtpd,1460,1560,0.0) smtpd: scheduler (smtpd)
(root,560,808,0.0) /usr/sbin/inetd
(_sndio,2668,24,0.0) /usr/bin/sndiod
(_sndiop,2660,24,0.0) sndiod: helper (sndiod)
(root,888,1240,0.0) /usr/sbin/cron
(root,1196,4032,0.0) sshd: admin [priv] (sshd)
(admin,1400,3348,0.0) sshd: admin@ttyp0 (sshd)
(admin,896,908,0.0) -ksh (ksh)
(root,964,960,0.0) -ksh (ksh)
(root,900,924,0.0) /bin/sh ./check_mk_agent
(root,664,676,0.0) ps -ax -o user
(root,536,1424,0.0) sed -e 1d -e s/ *\\([^ ]*\\) *\\([^ ]*\\) *\\([^ ]*\\
(root,520,24,0.0) /usr/libexec/getty std.9600 ttyC0
(root,508,24,0.0) /usr/libexec/getty std.9600 ttyC1
(root,516,24,0.0) /usr/libexec/getty std.9600 ttyC2
(root,520,24,0.0) /usr/libexec/getty std.9600 ttyC3
(root,512,24,0.0) /usr/libexec/getty std.9600 ttyC5
<<<cpu>>>
0.00 0.02 0.05 2/40 1
<<<uptime>>>
267705
<<<openbsd_mem>>>
MemTotal:	 506736 kB
MemFree:	 4252 kB
SwapTotal:	 262144 kB
SwapFree:	 238944 kB
<<<lnx_if:sep(58)>>>
em0:   0 0 0 0 0    0 0  0 0
1500:   0 0 0 0 0    0 0  0 0
<Link>:   0 0 0 0 0    0 0  0 0
00:0c:29:84:06:b9:   0 0 0 0 0    0 0  0 0
528211:   0 0 0 0 0    0 0  0 0
0:   0 0 0 0 0    0 0  0 0
[em0]
	Duplex: Half
	Auto-negotiation: off
	Address:
[1500]
	Address:
[<Link>]
	Address:
[00:0c:29:84:06:b9]
	Address:
[528211]
	Address:
[0]
	Address:

Can you verify this on another system?
The output looks pretty crooked, and I think there is something else wrong.
What do the following print?

netstat -in | grep '<Link>' | grep -v -E "\*|lo|pfsync|enc"
netstat -inb | grep '<Link>' | grep -v -E "\*|lo|pfsync|enc"
ifconfig

Hi Robin,

I will test it on a other machine later.

Here is the output

ntp# netstat -in | grep '<Link>' | grep -v -E "\*|lo|pfsync|enc"
em0     1500  <Link>      00:0c:29:84:06:b9    70383     0    49920     0     0
ntp# netstat -inb | grep '<Link>' | grep -v -E "\*|lo|pfsync|enc"
em0     1500  <Link>      00:0c:29:84:06:b9   14281441    6201531
ntp# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
	index 3 priority 0 llprio 3
	groups: lo
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
	inet 127.0.0.1 netmask 0xff000000
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	lladdr 00:0c:29:84:06:b9
	index 1 priority 0 llprio 3
	groups: egress
	media: Ethernet autoselect (1000baseT full-duplex,master)
	status: active
	inet 192.168.1.11 netmask 0xffffff00 broadcast 192.168.1.255
enc0: flags=0<>
	index 2 priority 0 llprio 3
	groups: enc
	status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
	index 4 priority 0 llprio 3
	groups: pflog

Thank you

I can comfirm; on other OpenBSD 7.1, same issue…

Line 130-131 changes the IFS (Input Field Separator).
On line 131 it’s indented, remove the whitespaces so the ’ on line 131 is at the beginning of the line.
(Line numbers refer to the ones in version 2.1.0p9)

1 Like

Thank you!
This was the fix for me!

You’re welcome. I also submitted the fix to the upstream repo, check_mk_agent.openbsd: Fix network parsing bug by Gnitset · Pull Request #501 · tribe29/checkmk · GitHub.