Status linux server monitor script


#!/bin/bash
# stat-mon.sh

echo “……………………. SERVER MONITORING REPORT ……………………..” > /scripts/report.txt
echo “APACHE SERVER:-” >> /scripts/report.txt
/sbin/service httpd status >> /scripts/report.txt
echo “MYSQL SERVER:-” >> /scripts/report.txt
/sbin/service mysqld status >> /scripts/report.txt
echo “SSH/SFTP:-” >> /scripts/report.txt
/sbin/service sshd status >> /scripts/report.txt
echo “SENDMAIL:-” >> /scripts/report.txt
/etc/init.d/sendmail status >> /scripts/report.txt
echo “…………………………………………………………..” >> /scripts/report.txt

echo “…………………….DISK SPACE …………………..” >> /scripts/report.txt
echo “…………………………………………………………..” >> /scripts/report.txt
df -h >> /scripts/report.txt
echo “…………………………………………………………………….” >> /scripts/report.txt
echo “…………………………………………………………………….” >> /scripts/report.txt
echo “SYSTEM LOAD AVERAGE” >> /scripts/report.txt
top -bn1 | grep -3 “load average” >> /scripts/report.txt
echo “…………………………………………………………………….” >> /scripts/report.txt
#top -n1 >> /scripts/report.txt
echo “…………………………………………………………………….” >> /scripts/report.txt
echo “Report generated on $(date)” >> /scripts/report.txt
echo “……………………. END OF REPORT ……………………..” >> /scripts/report.txt

mail -s “Server Stats on $(date)” user@somedomain.com < /scripts/report.txt

Tags: linux, monitoring, server
Last update:
2013-07-18 16:15
Author:
Admin
Revision:
1.1
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.