#!/bin/zsh

# Monitoring du nombre de sessions ssh ouvertes
# sur la machine

if [ "$1" = "autoconfig" ]; then
   echo "yes"
elif [ "$1" = "config" ]; then
   echo "graph_title Connexions ssh"
   echo "graph_args --base 1000 -l 0"
   echo "total.label Nombre de connexions ouvertes"
   echo "total.draw AREA"
   echo "uniq.label Nombre de personnes connectés"
   echo "uniq.draw AREA"
else
   who=$(/usr/bin/who | cut -d' ' -f1)
   echo "total.value $(echo $who | wc -l)"
   echo "uniq.value $(echo $who | sort | uniq | wc -l)"
fi
   

