#!/bin/sh

if [ "$1" = "config" ]; then

#        echo 'host_name adherents'
	echo 'graph_title Machines connectees'
	echo "graph_args --base 1000 --lower-limit 0"
	echo "graph_vlabel nombre de machines"
	echo 'ens.label ENS'
	echo 'ens.draw AREA'
	echo 'adm.label ADM'
	echo 'adm.draw STACK'
	echo "ap.label Point d'accès"
	echo 'ap.draw STACK'
	echo 'fixe.label Fixe'
	echo 'fixe.draw STACK'
	echo 'wifi.label Wifi'
	echo 'wifi.draw STACK'
	echo 'total.label Total'
	exit 0
fi

scan() {
  arp -a -n -i $1
}

echo "ens.value" `scan ens | wc -l`
echo "adm.value" `scan crans.2 | wc -l`
echo "fixe.value" `scan crans | wc -l`
echo "wifi.value" `scan crans.3 | grep -v '138\.231\.148\.' | wc -l`
echo "ap.value" `scan crans.3 | grep '138\.231\.148\.' | wc -l`
echo "total.value" `arp -a -n | wc -l`
