From: Alexander Barton Date: Thu, 6 Oct 2011 14:46:17 +0000 (+0200) Subject: HardwareInfo.tst: New test to display DMI/SMBIOS hardware information X-Git-Tag: rel-3~6 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=nagcollect.git;a=commitdiff_plain;h=c2c0bb4205d7f6ee019388771dfeadafa65f015d HardwareInfo.tst: New test to display DMI/SMBIOS hardware information --- diff --git a/client/lib/tests/HardwareInfo.tst b/client/lib/tests/HardwareInfo.tst new file mode 100644 index 0000000..1d88529 --- /dev/null +++ b/client/lib/tests/HardwareInfo.tst @@ -0,0 +1,37 @@ +# NagCollect -- Nagios Data Collector for Passive Checks +# Copyright (c)2010-2011 Alexander Barton, alex@barton.de + +# Check Hardware Information from DMI/SMBIOS + +type -p dmidecode >/dev/null 2>&1 +if [ $? -eq 0 ]; then + + SERVICE="HwInfo_p" + STATUS=0 + + sn=`dmidecode -s system-serial-number` + product=`dmidecode -s system-product-name` + manufacturer=`dmidecode -s system-manufacturer` + + case "$product" in + "VMware Virtual Platform") + sn=""; ;; + esac + case "$sn" in + *"OEM"*|*"O.E.M"*) + sn=""; ;; + esac + + if [ -n "$manufacturer" -a -n "$product" ]; then + TEXT="$manufacturer: $product" + else + TEXT="$manufacturer$product" + fi + + if [ -n "$sn" ]; then + [ -n "$TEXT" ] \ + && TEXT="$TEXT, S/N $sn" \ + || TEXT="S/N $sn" + fi + +fi