Yes, this is definitely possible and a common requirement for deep network analysis. Since you are looking for specific metrics not covered by the standard lnx_if or systemd checks, here is how you can approach this:
1. Data Sources
PPS & Errors: The file /proc/net/snmp is the source of truth here.
For UDP, look at InDatagrams, OutDatagrams, and InErrors.
For TCP, look at InSegs, OutSegs, and RetransSegs.
Memory: * Limits:/proc/sys/net/ipv4/udp_mem (Note: Values are in Pages, not Bytes. You’ll need to multiply by your Page Size, usually 4096).
Current Usage:/proc/net/sockstat is better for real-time usage (the mem value in the UDP line).
2. Implementation in Checkmk
Since you are on Checkmk 2.4, I recommend using a Local Script or a small Python Agent Plugin.
Simple Local Script (Bash) Example:
Place this in /usr/lib/check_mk_agent/local/udp_stats
#!/bin/bash
# Get UDP stats from /proc/net/snmp
udp_line=$(grep "Udp:" /proc/net/snmp | tail -n 1)
in_pps=$(echo $udp_line | awk '{print $2}')
out_pps=$(echo $udp_line | awk '{print $5}')
errs=$(echo $udp_line | awk '{print $3}')
# Get UDP memory from sockstat (value is in pages)
pages=$(grep "UDP:" /proc/net/sockstat | awk '{print $5}')
page_size=$(getconf PAGESIZE)
mem_bytes=$((pages * page_size))
echo "P UDP_PPS in_pps=${in_pps}|out_pps=${out_pps}|errors=${errs} UDP Packets and Errors"
echo "P UDP_Memory mem_used=${mem_bytes} UDP Memory Usage"
3. Why this way?
Directly parsing /proc is much more efficient than calling netstat or ss inside a loop. Checkmk will automatically turn these pipe-separated values into beautiful Perf-O-Meters and graphs.
Aren’t the the values from /proc/net/snmp are counters?
Does it make sense to plot an increasing counter?
Could it be the case that this is just an answer from a random AI tool and if yes shouldn’t it be marked as AI generated ?
You are correct — the values in /proc/net/snmp are monotonically increasing counters since system boot. To get meaningful data, you need to calculate the delta between two samples over a fixed interval:
This gives you the actual rate (e.g. retransmits/sec) rather than a raw ever-growing number. Tools like sar -n TCP or ss -s handle this automatically if you prefer a ready-made solution.
So sorry for the translation mismatch … or missunderstanding