StarOS MRTG setup to track Associations

After spending a few hours on it, I was able to hack together a shell script that will query a staros system for the number of associations on a wireless card, and then put it into MRTG.

Here is the shell script:

——

# !/bin/sh

# Pulls the number of associations on a wireless card
# Takes an IP address, password and wireless interface as arguments

IPADDRESS=$1
PASSWORD=$2
INTERFACE=$3
STAR=/root/stationserver/starutil

$STAR $1 $2 -ci $3 -da |
grep -A 1 “Clients” |
head -n 1 |
sed -e ’s/  */ /g’ -e ’s/-//g’ |
cut -d” ” -f11
sleep 1

$STAR $1 $2 -ci $3 -da |
grep -A 1 “Clients” |
head -n 1 |
sed -e ’s/  */ /g’ -e ’s/-//g’ |
cut -d” ” -f11
sleep 1

—-

To run the script, just put in the script name, followed by the IP address of the staros unit, password and interface that you want to check.  For example…

associations.sh 192.168.1.1 1234 wlan1

To get MRTG to graph the results, use the following format in your mrtg config file:

Target[starosap.associations]: `associations.sh 192.168.1.1 1234 wlan1`
PageTop[starosap.associations]:

Connections on StarOS AP


MaxBytes[staros.associations]: 100
AbsMax[staros.associations]: 100
WithPeak[staros.associations]: dym
Options[staros.associations]: gauge, nopercent
ShortLegend[staros.associations]:  
Ylegend[staros.associations]: Connections
Title[staros.associations]: Connections on StarOS AP

This is what made it work for me!

Matt Larsen

mlarsen@inventivemedia.net