#!/bin/sh # --------------------------------------------------------------------------------- # Script: stats Author: Dean Stringer # # reports following server stats, outputs to STDOUT... # # - Disk Usage # - Memory Use # - File Handles # - Processes (MySQL, Apache) # - Telnet Sessions # - Appletalk Sessions # --------------------------------------------------------------------------------- # Date/time/uptime echo --------------------------------------------------------------------------------- echo "Server: `hostname`" echo "Date: `date`" echo "Uptime: `uptime`" echo --------------------------------------------------------------------------------- # Disk usage echo "# DISK USAGE" df -h # Memory usage echo "# MEMORY" free -o # Open Files echo "# FILE HANDLES" FILEAPACHE=`lsof | grep apache | wc -l` echo "Apache: $FILEAPACHE" echo "MySQL: `lsof | grep mysql | wc -l`" echo "SSH: `lsof | grep sshd | wc -l`" echo "SendMail: `lsof | grep sendmail | wc -l`" echo "Total: `lsof | wc -l`" # User Processes echo "# PROCESSESS" ps aux | egrep -v "root|www-data|daemon|afpd" # Apache Processes echo "# APACHE" ps aux | grep apache | egrep -v grep # MySQL Processes echo "# MYSQL" ps aux | grep mysql | egrep -v grep # Telnet Connections echo "# TELNET SESSIONS" ps aux | grep bash # Appletalk Connections echo "# APPLETALK SESSIONS" ps aux | grep afpd | egrep -v root exit 0