Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions snmp/hardware
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh
# Detects which hardware.

if [ -r /sys/devices/virtual/dmi/id/product_name ]; then
DMI=$(cat /sys/devices/virtual/dmi/id/product_name)
fi
if [ -r /sys/firmware/devicetree/base/model ]; then
DT=$(cat /sys/firmware/devicetree/base/model)
fi

if [ -n "${DMI}" ]; then
if [ "${DMI}" != "To Be Filled By O.E.M." ] && [ "${DMI}" != "Default string" ] && [ "${DMI}" != "Not Specified" ] && [ "${DMI}" != "None" ] ; then
HARDWARESTR="${DMI}"
fi
fi
if [ -z "${HARDWARESTR}" ] && [ -n "${DT}" ]; then
HARDWARESTR="${DT}"
fi

echo "${HARDWARESTR}"
14 changes: 14 additions & 0 deletions snmp/manufacturer
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh
# Detects which manufacturer.

if [ -r /sys/devices/virtual/dmi/id/sys_vendor ]; then
DMI=$(cat /sys/devices/virtual/dmi/id/sys_vendor)
fi

if [ -n "${DMI}" ]; then
if [ "${DMI}" != "To Be Filled By O.E.M." ] && [ "${DMI}" != "Default string" ] && [ "${DMI}" != "Not Specified" ] && [ "${DMI}" != "None" ] ; then
MANUFACTURERSTR="${DMI}"
fi
fi

echo "${MANUFACTURERSTR}"
20 changes: 20 additions & 0 deletions snmp/serial
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh
# Detects which serial.

if [ -r /sys/devices/virtual/dmi/id/product_serial ]; then
DMI=$(cat /sys/devices/virtual/dmi/id/product_serial)
fi
if [ -r /sys/firmware/devicetree/base/serial-number ]; then
DT=$(cat /sys/firmware/devicetree/base/serial-number)
fi

if [ -n "${DMI}" ]; then
if [ "${DMI}" != "To Be Filled By O.E.M." ] && [ "${DMI}" != "Default string" ] && [ "${DMI}" != "Not Specified" ] && [ "${DMI}" != "None" ] ; then
SERIALSTR="${DMI}"
fi
fi
if [ -z "${SERIALSTR}" ] && [ -n "${DT}" ]; then
SERIALSTR="${DT}"
fi

echo "${SERIALSTR}"