Skip to content

Commit

Permalink
Avoid flooding the console with snmpd debug log (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 authored Jan 7, 2024
1 parent a33da92 commit a3afeec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions snmpd/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.2.2
- add additional hass information via `NET-SNMP-EXTEND-MIB`
- fix logging to not flood the console with snmpd debug log

## 0.2.1
- fix libreNMS hardware detection for arm platforms
Expand Down
12 changes: 8 additions & 4 deletions snmpd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ UN_KERNEL_RELEASE=$(uname -r)
UN_KERNEL_VERSION=$(uname -v)
UN_MACHINE=$(uname -m)

cat > /etc/snmp/snmpd.conf <<EOF
SNMP_CONF_FILE="/etc/snmp/snmpd.conf"

cat > $SNMP_CONF_FILE <<EOF
master agentx
com2sec readonly default $COMMUNITY
sysname $NAME
syslocation $LOCATION
Expand All @@ -40,19 +44,19 @@ extend distro '/bin/echo $HAOS_OPERATING_SYSTEM'
EOF

if [[ "$UN_MACHINE" == "x86"* ]]; then
cat >> /etc/snmp/snmpd.conf <<EOF
cat >> $SNMP_CONF_FILE <<EOF
#libreNMS Hardware Detection
extend manufacturer '/bin/cat /sys/devices/virtual/dmi/id/sys_vendor'
extend hardware '/bin/cat /sys/devices/virtual/dmi/id/product_name'
extend serial '/bin/cat /sys/devices/virtual/dmi/id/product_serial'
EOF
elif [[ "$UN_MACHINE" == "arm"* ]] || [[ "$UN_MACHINE" == "aarch64"* ]]; then
cat >> /etc/snmp/snmpd.conf <<EOF
cat >> $SNMP_CONF_FILE <<EOF
#libreNMS Hardware Detection
extend hardware '/bin/echo $HAOS_MACHINE'
EOF
fi

# Run daemon
bashio::log.info "Starting the snmpd daemon..."
snmpd -f -LSid -c /etc/snmp/snmpd.conf
snmpd -f -LSwd

0 comments on commit a3afeec

Please sign in to comment.