ReachableCEO-ShellScriptPor.../sitrep.sh

21 lines
1.9 KiB
Bash

#!/bin/bash
#A script to produce a current situation report for a server
echo -e "\e[1;34;47mSystem uptime/load:\e[0m" ; uptime;
echo -e "\e[1;34;47mSystem hostname and IP address:\e[0m"; hostname && hostname -i;
echo -e "\e[1;34;47mDisk usage:\e[0m"; df -i; df -h;
echo -e "\e[1;34;47mPHP process count:\e[0m" ;ps faux |grep php | wc -l;
echo -e "\e[1;34;47mMemory:\e[0m"; free -m; cat /proc/meminfo | egrep 'MemTotal|MemFree';
echo -e "\e[1;34;47mNumber of and model ofCPU:\e[0m"; cat /proc/cpuinfo | grep processor | wc -l; cat /proc/cpuinfo | grep "model name";
echo -e "\e[1;34;47mSoftware Versions:\e[0m"; php -v; mysql --version; httpd -v;
echo -e "\e[1;34;47mExim Message Count:\e[0m"; exim -bpc;
echo -e "\e[1;34;47mFTP Connection Count:\e[0m"; netstat -pan |grep :21|wc -l;
echo -e "\e[1;34;47mApache Connection Count:\e[0m";netstat -pan|grep :80|wc -l;
echo -e "\e[1;34;47mSSH Connection Count:\e[0m"; netstat -pan|grep :22|wc -l;
for i in $(ls /var/log/sa/sa[0-31]*);do echo "Average System load for $(date +%B) $i" ; sar -f $i -q|tail -n 1 ; done;for i in $(ls /var/log/sa/sa[0-31]*);do echo "Average System load for $(date +%B) $i" ; sar -f $i -r|tail -n 1 ; done;
if [ -e /proc/user_beancounters ]; then echo -e "\e[1;34;47mUser Beancounters:\e[0m" && cat /proc/user_beancounters | awk '{if ($NF>0){print$0}}';fi;
echo -e "\e[1;34;47mrunning processes:\e[0m" ; ps faux|egrep -v 'init|watchdog|iscsi|cqueue|kmpath|iscsid|syslogd|kpsmoused|auditd|irqbalance|rpc.idmapd|hcid|kmpathd|ib_cm|rpciod|migration|kjournald|scsi_eh_0|scsi_eh_1|khubd|kswapd0|kedac|kauditd|udevd|named|mingetty|agetty|dbus|kacpid|kblockd|pdflush|ksoftirqd|khelper|kthread|kseriod|klogd|acpid|spamd|cpsrvd|pure-authd|/usr/sbin/courierlogger|/usr/lib/courier-imap';blockcount=$(ip ro |grep blackhole | wc -l); if [ $blockcount -gt 0 ]; then echo -e "\e[1;34;47mBlocked IP Addresses:\e[0m"; ip ro |grep blackhole; fi