Tuesday, 23 December 2014

Shell script that will allow live monitoring of Apache Server

This the script that will enable live monitoring of Apache Server Ex. Who is currently logged on to it.

It will be look like the following screen shot .

Note: This script will work for Ubuntu (All  versions) and Debian(All Version ) only. There is another script for Redhat , Centos and Fedora.

Writer: Anuj Borah
Email: anujborah1@gmail.com

Writer: Anuj Borah
Email: anujborah1@gmail.com
sleep 3
echo "This the script for apache server monitoring.(Press F5 to refress)"
sleep 3
if [ $UID -eq 0 ]
dpkg -l apache2 && echo "Congrats ,Apache is installed" || echo "Apache is not installed type (apt-get install apache2) to linstall apache"
sleep 3
a2enmod status > /dev/null
echo "Give the ip address to which u want to associate for apache server monitoring " ; read p

echo "<IfModule mod_status.c>
    # Allow server status reports generated by mod_status,
    # with the URL of http://servername/server-status
    # Uncomment and change the "" to allow access from other hosts.

    <Location /server-status>
        SetHandler server-status
        Require local
        Allow from ::1 $p
        #Require ip

    # Keep track of extended status information for each request
    ExtendedStatus On

    # Determine if mod_status displays the first 63 characters of a request or
    # the last 63, assuming the request itself is greater than 63 chars.
    # Default: Off
    #SeeRequestTail On

    <IfModule mod_proxy.c>
        # Show Proxy LoadBalancer status in mod_status
        ProxyStatus On


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet" > /etc/apache2/mods-enabled/status.conf

service apache2 restart > /dev/null

echo "All Done. Now i will enable the system.(Press F5 to refress) "
sleep 3

echo "&&&&&&This Script will run as root only ,  login as root and try $0  again. &&&&&&"

No comments:

Post a Comment

Popular Posts