]> pere.pagekite.me Git - homepage.git/blob - linux/mrtg/smb-machines-used.sh
Switched blog to hungry.com for now. Updated all links.
[homepage.git] / linux / mrtg / smb-machines-used.sh
1 #!/bin/sh
2 #
3 # Author: Petter Reinholdtsen <pere@td.org.uit.no>
4 # Date: 1999-04-26
5 #
6 # MRTG datagenerator to get number of WinNT machines connected to
7 # local samba server.
8
9 PATH=/usr/local/samba/bin:$PATH
10 export PATH
11
12 ALLHOSTREGEX="$1"
13 #ALLHOSTREGEX="ember|nightfall|dewshine"
14
15 LINUXUSERS=`rwho| egrep "$ALLHOSTREGEX" | grep '::0 ' | awk '{print $2}' |
16 sort -u | wc -l`
17 WINNTUSERS=`/usr/local/samba/bin/smbstatus 2>/dev/null | egrep
18 "$ALLHOSTREGEX" |
19 grep -v Profile | grep -v IPC | awk '{print $3}' | sort -u | wc -l`
20
21 echo $WINNTUSERS
22 echo $LINUXUSERS
23 date
24 hostname