/usr/share/doc/nagios-plugin-check-multi/examples/network_interface.cmd is in nagios-plugin-check-multi 0.26-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #
# network_interface.cmd (adopted for Linux hosts)
#
# Copyright (c) 2008-2009 Matthias Flacke (matthias.flacke at gmx.de)
#
# Matthias Flacke, 20.01.2008
# determine def_gw interface from /proc/net/route
command [ def_gw ] = awk '$2 == "00000000" {print $1}' /proc/net/route
# get ethtool output and store it in temporary file
command [ ethtool ] = sudo /sbin/ethtool $def_gw$ > /tmp/if_$def_gw$.txt \
&& echo OK
# get interface settings using ethtool
command [ link ] = awk '/Link detected:/ {print $3}' /tmp/if_$def_gw$.txt
command [ speed ] = awk '/Speed:/ {print $2}' /tmp/if_$def_gw$.txt
command [ duplex ] = awk '/Duplex:/ {print $2}' /tmp/if_$def_gw$.txt
command [ autoneg ] = awk '/Auto-negotiation:/ {print $2}' /tmp/if_$def_gw$.txt
# evaluate results
state [ UNKNOWN ] = "$def_gw$" eq "" || ethtool != OK
state [ WARNING ] = ("$speed$" && "$speed$" !~ /100/) || \
("$duplex$" && "$duplex$" !~ /FULL/i)
state [ CRITICAL] = "$link$" && "$link$" eq "no"
|