#!/bin/sh
#
# Author: Petter Reinholdtsen <pere@td.org.uit.no>
# Date:   1999-04-26
#
# MRTG datagenerator to get number of WinNT machines connected to
# local samba server.

PATH=/usr/local/samba/bin:$PATH
export PATH

ALLHOSTREGEX="$1"
#ALLHOSTREGEX="ember|nightfall|dewshine"

LINUXUSERS=`rwho| egrep "$ALLHOSTREGEX" | grep '::0 ' | awk '{print $2}' |
  sort -u | wc -l`
WINNTUSERS=`/usr/local/samba/bin/smbstatus 2>/dev/null | egrep
"$ALLHOSTREGEX" |
  grep -v Profile | grep -v IPC | awk '{print $3}' | sort -u | wc -l`

echo $WINNTUSERS
echo $LINUXUSERS
date
hostname
