Munin plugin wifi signal

Iš Žinynas.
Jump to navigation Jump to search

Munin pluginas skirtas monitorinti wifi interfeisų signalų stiprumą ir triukšmą.

Screenshot 2020-03-10 at 11.59.56.png

Sudedam į /etc/munin/plugins/wifi_signal

#!/bin/bash
#
# Show noise and signal levels of wifi enabled devices.
# Author: Nicolai Langfeldt, janl@linprolno
# Modifications: Sebastián Cruz, crux@lugmen.org.ar
# License: GPL v. 2
#
#%# family=auto
#%# capabilities=autoconf

PNWL=/proc/net/wireless

do_fetch () {
    awk -F'[ :]*' '/:/ {
                gsub(/\. /," ",$0); # Remove periods with no decimals after
	        print $2"_noise.value "$6;
	        print $2"_signal.value "$5;
	}' $PNWL
}

do_config () {
    echo "graph_title WiFi signal and noise"
    echo "graph_args --base 1000 -u 0"
    echo "graph_vlabel dB"
    echo "graph_category wireless"
    echo "graph_info This graph shows the noise and singal levels of your WiFi devices"

    awk -F'[ :]*' '/:/ {
	        print $2"_noise.label Noise "$2;
	        print $2"_signal.label Signal "$2;
	}' $PNWL
}

do_autoconf () {
    if [ ! -f "$PNWL" ]; then
        echo "no (missing file '$PNWL')"
    elif [ ! -r "$PNWL" ]; then
        echo "no (cannot read file '$PNWL')"
    elif grep -qs : "$PNWL"; then
        echo yes
    else
        echo "no (no devices in $PNWL)"
    fi
    exit 0
}

case $1 in
    config|autoconf)
        eval do_$1
	exit 0;;
    '')
        do_fetch
	exit 0;;
esac