1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00
Files
librenms-librenms-agent/snmp/Openwrt/wlNoiseFloor.sh
2021-03-18 20:07:25 +01:00

20 lines
641 B
Bash
Executable File

#!/bin/sh
# wlNoiseFloor.sh
# Returns wlNoiseFloor, in dBm
# Arguments: targed interface
# Check number of arguments
if [ $# -ne 1 ]; then
/bin/echo "Usage: wlNoiseFloor.sh interface"
/bin/echo "Missing targeted interface, exiting."
exit 1
fi
# Extract noise floor. Note, all associated stations have the same value, so just grab the first one
# Use tail, not head (i.e. last line, not first), as head exits immediately, breaks the pipe to cut!
noise=$(/usr/bin/iwinfo "$1" assoclist | /usr/bin/cut -s -d "/" -f 2 | /usr/bin/cut -s -d "(" -f 1 | /usr/bin/cut -s -d " " -f 2 | /usr/bin/tail -1)
# Return snmp result
/bin/echo "$noise"