From c2c0bb4205d7f6ee019388771dfeadafa65f015d Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Thu, 6 Oct 2011 16:46:17 +0200 Subject: [PATCH] HardwareInfo.tst: New test to display DMI/SMBIOS hardware information --- client/lib/tests/HardwareInfo.tst | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 client/lib/tests/HardwareInfo.tst 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 -- 2.39.2