http service uptime

http service uptime

We all know about uptime command purpose in Linux, it is used to check system uptime like, how long the system has been running without reboot and down.

Each services has their own commands to check the service uptime, also we can check the services uptime using ps command. It will shows when the parent process started and how long the service has been running.

There are multiple method to check the uptime of http process. Some of them are below mentioned. Let’s have a look.

  • web server uptime via mod_status module

The Apache mod_status module allows a server administrator to check apache web server uptime, concurrent connections and server performance with given interval through CLI, also we can access this through web browser with HTML interface.

How to Install/Enable mod_status module

By default, mod_status module enabled on Apache. The reports are commented and you can not access it. Just uncomment below code in your Apache config file to enable it.
For RHEL/CentOS/Fedora systems, open /etc/httpd/conf/httpd.conf file and uncomment the below codes.

[For Apache 2.2]
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from all
</Location>

[For Apache 2.4]
<Location “/server-status”>
SetHandler server-status
Require host localhost
</Location>

For Debian/Ubuntu systems, open /etc/apache2/mods-enabled/status.conf file and uncomment the below codes. Uncomment and change the “192.0.1.0/24” to allow access from other hosts.
<Location “/server-status”>
SetHandler server-status
Require local
#Require ip 192.0.1.024
</Location>

  • Web server uptime via PS Command

ps -eo comm,etime | grep apache2

 

Leave a Reply