]> arthur.barton.de Git - nagcollect.git/blob - client/lib/tests/HardwareInfo.tst
HardwareInfo.tst: New test to display DMI/SMBIOS hardware information
[nagcollect.git] / client / lib / tests / HardwareInfo.tst
1 # NagCollect -- Nagios Data Collector for Passive Checks
2 # Copyright (c)2010-2011 Alexander Barton, alex@barton.de
3
4 # Check Hardware Information from DMI/SMBIOS
5
6 type -p dmidecode >/dev/null 2>&1
7 if [ $? -eq 0 ]; then
8
9         SERVICE="HwInfo_p"
10         STATUS=0
11
12         sn=`dmidecode -s system-serial-number`
13         product=`dmidecode -s system-product-name`
14         manufacturer=`dmidecode -s system-manufacturer`
15
16         case "$product" in
17           "VMware Virtual Platform")
18                 sn=""; ;;
19         esac
20         case "$sn" in
21           *"OEM"*|*"O.E.M"*)
22                 sn=""; ;;
23         esac
24
25         if [ -n "$manufacturer" -a -n "$product" ]; then
26                 TEXT="$manufacturer: $product"
27         else
28                 TEXT="$manufacturer$product"
29         fi
30
31         if [ -n "$sn" ]; then
32                 [ -n "$TEXT" ] \
33                         && TEXT="$TEXT, S/N $sn" \
34                         || TEXT="S/N $sn"
35         fi
36
37 fi