[K12OSN] Looking to gather and maybe graph logon stats (Re:Just about ready to make a purchase)

Dan Young dyoung at mesd.k12.or.us
Thu May 10 17:31:06 UTC 2007


John Baillie wrote:
> It got me thinking about gathering some stats on our concurrent usage.

For CPU/memory usage, etc.

yum install sysstat

Wait a while, then:

sar

The accounting tool will collect stats from /proc every ten minutes,
storing them in /var/log/sa/. "man sar" to see some of the options.

"sar -r" shows memory and swap usage.

If you just want to know how many users are logged in at ten minute
intervals, you could try something like this in cron, running every 10
minutes:

# root's crontab
*/10 * * * * /usr/local/bin/usercount

############
#!/bin/bash
# put me in /usr/local/bin/usercount
USERS=$(last | grep 'still logged in' | awk '{print $1}' \
| sort -u  | wc -l)
TIME=$(date --rfc-3339='seconds')
echo $TIME - $USERS >> /tmp/usercount
############

Just a dumb shell script, but quick 'n dirty is OK sometimes.

-- 
Dan Young <dyoung at mesd.k12.or.us>
Multnomah ESD - Technology Services
503-257-1562




More information about the K12OSN mailing list