apache-top
Descripción
apache-top muestra en tiempo real los procesos activos de un servidor apache remoto. Es similar al comando top de linux.
Con él se pueden ver:
- Los procesos activos de apache, con su PID, el estado, los segundos que lleva activo, el uso de CPU, el virtualhost asociado, la ip desde la que se está accediendo, y la petición (POST o GET, el fichero que se está sirviendo y el protocolo utilizado).
- El tiempo que lleva arrancado el servidor web y la hora en que se reinició por última vez
- El consumo de cpu
- El número de peticiones por segundo, el número de Kb por segundo y la media de Kb por petición
- El número de procesos activos y inactivos
- Un gráfico donde se pueden ver los procesos inactivos, los activos y el estado en que están.
Requerimientos
- python 2.4
- Servidor web apache 2.0 con mod_status activado y la directiva ExtendedStatus activada con permiso para acceder desde la ip desde la que se lanza el programa
Descarga
Ejemplos
Para ver las estadísticas del servidor 192.168.0.1, ejecutariamos este comando:
apache-top -u http://192.168.0.1/server-status
Si por alguna razon no tenemos acceso directo al puerto 80, podemos utilizar ssh para crear un tunel. En una consola ejecutamos:
ssh -L 8080:localhost:80 192.168.0.1
y en otra:
apache-top -u http://localhost:8080/server-status
Enlaces
Screenshots
Licencia
apache-top utiliza la licencia GNU/GPL
fr3nd.net
English version here



Thanks for this project! This is exactly what I’m looking for. apachetop is good, but it is totaly useless in case you have different access log for every virutal host.
In program help (with ?) will be great.
Kepi, apache-top doesn’t use the access log to retrieve the information, so having different logs for every virtualhost doesn’t affect it
Is there an older version that works with Apache 1?
Chris: Sorry, but there is no version compatible with apache 1.
fr3nd: (reply to 2)
Yes, I know it! I talk about apachetop (the one without – :) as you said.. simmilar project with diferent approach). I like it but it is useless for me cause it depends on access logs.
And this is why I love your’s apache-top :) It saves my live many times from time i wrote here for the first time. Thanks again.
Hello, on a cPanel server when starting it:
./apache-top.py -u http://localhost/whm-server-status
ERROR parsing the data. Please, make sure you are alowed to read the server-status page and you have ExtendedStatus flag activated
What may be the problem ?
Thanks,
Docenta: Check you’re using apache 2.0 and try to access to that url using a “normal” browser to see if the server-status page works correctly.
Hey, thanks for writing it! I love it!
Hello
Ahm ill try to run it but i just recive a blank sreen. also cannot exit by q or ctrl-c must stop the przess and kill it by sigjkill
im running debian etch, python 2.4.4 and also an actual apache2
the status site is reachable by lynx on same terminal
get no error message nothing
same happens wenn i try to use a bad url
ok when i try it with debug form python (python -d apache-top…. ill recive an error wehn i run it on a bad url but still nothing when the url is corrent
anyone an idea?
now ife tryit with verbose and debug
below thats what i recieve
# /usr/lib/python2.4/httplib.pyc matches /usr/lib/python2.4/httplib.py
import httplib # precompiled from /usr/lib/python2.4/httplib.pyc
# /usr/lib/python2.4/mimetools.pyc matches /usr/lib/python2.4/mimetools.py
import mimetools # precompiled from /usr/lib/python2.4/mimetools.pyc
# /usr/lib/python2.4/rfc822.pyc matches /usr/lib/python2.4/rfc822.py
import rfc822 # precompiled from /usr/lib/python2.4/rfc822.pyc
# /usr/lib/python2.4/tempfile.pyc matches /usr/lib/python2.4/tempfile.py
import tempfile # precompiled from /usr/lib/python2.4/tempfile.pyc
# /usr/lib/python2.4/random.pyc matches /usr/lib/python2.4/random.py
import random # precompiled from /usr/lib/python2.4/random.pyc
dlopen(“/usr/lib/python2.4/lib-dynload/math.so”, 2);
import math # dynamically loaded from /usr/lib/python2.4/lib-dynload/math.so
dlopen(“/usr/lib/python2.4/lib-dynload/binascii.so”, 2);
import binascii # dynamically loaded from /usr/lib/python2.4/lib-dynload/binascii.so
dlopen(“/usr/lib/python2.4/lib-dynload/_random.so”, 2);
import _random # dynamically loaded from /usr/lib/python2.4/lib-dynload/_random.so
dlopen(“/usr/lib/python2.4/lib-dynload/fcntl.so”, 2);
import fcntl # dynamically loaded from /usr/lib/python2.4/lib-dynload/fcntl.so
import thread # builtin
dlopen(“/usr/lib/python2.4/lib-dynload/cStringIO.so”, 2);
import cStringIO # dynamically loaded from /usr/lib/python2.4/lib-dynload/cStringIO.so
vpn:/bin/wartung# python -d -v apache-top -u http://localhost/server-status
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/lib/python2.4/site.pyc matches /usr/lib/python2.4/site.py
import site # precompiled from /usr/lib/python2.4/site.pyc
# /usr/lib/python2.4/os.pyc matches /usr/lib/python2.4/os.py
import os # precompiled from /usr/lib/python2.4/os.pyc
import posix # builtin
# /usr/lib/python2.4/posixpath.pyc matches /usr/lib/python2.4/posixpath.py
import posixpath # precompiled from /usr/lib/python2.4/posixpath.pyc
# /usr/lib/python2.4/stat.pyc matches /usr/lib/python2.4/stat.py
import stat # precompiled from /usr/lib/python2.4/stat.pyc
# /usr/lib/python2.4/UserDict.pyc matches /usr/lib/python2.4/UserDict.py
import UserDict # precompiled from /usr/lib/python2.4/UserDict.pyc
# /usr/lib/python2.4/copy_reg.pyc matches /usr/lib/python2.4/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.4/copy_reg.pyc
# /usr/lib/python2.4/types.pyc matches /usr/lib/python2.4/types.py
import types # precompiled from /usr/lib/python2.4/types.pyc
# /usr/lib/python2.4/warnings.pyc matches /usr/lib/python2.4/warnings.py
import warnings # precompiled from /usr/lib/python2.4/warnings.pyc
# /usr/lib/python2.4/linecache.pyc matches /usr/lib/python2.4/linecache.py
import linecache # precompiled from /usr/lib/python2.4/linecache.pyc
import encodings # directory /usr/lib/python2.4/encodings
# /usr/lib/python2.4/encodings/__init__.pyc matches /usr/lib/python2.4/encodings/__init__.py
import encodings # precompiled from /usr/lib/python2.4/encodings/__init__.pyc
# /usr/lib/python2.4/codecs.pyc matches /usr/lib/python2.4/codecs.py
import codecs # precompiled from /usr/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/lib/python2.4/encodings/aliases.pyc matches /usr/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/lib/python2.4/encodings/aliases.pyc
# /usr/lib/python2.4/encodings/iso8859_15.pyc matches /usr/lib/python2.4/encodings/iso8859_15.py
import encodings.iso8859_15 # precompiled from /usr/lib/python2.4/encodings/iso8859_15.pyc
Python 2.4.4 (#2, Apr 16 2008, 17:58:59)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
apache-top: inconsistent use of tabs and spaces in indentation
# /usr/lib/python2.4/HTMLParser.pyc matches /usr/lib/python2.4/HTMLParser.py
import HTMLParser # precompiled from /usr/lib/python2.4/HTMLParser.pyc
# /usr/lib/python2.4/markupbase.pyc matches /usr/lib/python2.4/markupbase.py
import markupbase # precompiled from /usr/lib/python2.4/markupbase.pyc
# /usr/lib/python2.4/re.pyc matches /usr/lib/python2.4/re.py
import re # precompiled from /usr/lib/python2.4/re.pyc
# /usr/lib/python2.4/sre.pyc matches /usr/lib/python2.4/sre.py
import sre # precompiled from /usr/lib/python2.4/sre.pyc
# /usr/lib/python2.4/sre_compile.pyc matches /usr/lib/python2.4/sre_compile.py
import sre_compile # precompiled from /usr/lib/python2.4/sre_compile.pyc
import _sre # builtin
# /usr/lib/python2.4/sre_constants.pyc matches /usr/lib/python2.4/sre_constants.py
import sre_constants # precompiled from /usr/lib/python2.4/sre_constants.pyc
# /usr/lib/python2.4/sre_parse.pyc matches /usr/lib/python2.4/sre_parse.py
import sre_parse # precompiled from /usr/lib/python2.4/sre_parse.pyc
dlopen(“/usr/lib/python2.4/lib-dynload/operator.so”, 2);
import operator # dynamically loaded from /usr/lib/python2.4/lib-dynload/operator.so
# /usr/lib/python2.4/urllib.pyc matches /usr/lib/python2.4/urllib.py
import urllib # precompiled from /usr/lib/python2.4/urllib.pyc
# /usr/lib/python2.4/string.pyc matches /usr/lib/python2.4/string.py
import string # precompiled from /usr/lib/python2.4/string.pyc
dlopen(“/usr/lib/python2.4/lib-dynload/strop.so”, 2);
import strop # dynamically loaded from /usr/lib/python2.4/lib-dynload/strop.so
# /usr/lib/python2.4/socket.pyc matches /usr/lib/python2.4/socket.py
import socket # precompiled from /usr/lib/python2.4/socket.pyc
dlopen(“/usr/lib/python2.4/lib-dynload/_socket.so”, 2);
import _socket # dynamically loaded from /usr/lib/python2.4/lib-dynload/_socket.so
dlopen(“/usr/lib/python2.4/lib-dynload/_ssl.so”, 2);
import _ssl # dynamically loaded from /usr/lib/python2.4/lib-dynload/_ssl.so
import errno # builtin
dlopen(“/usr/lib/python2.4/lib-dynload/time.so”, 2);
import time # dynamically loaded from /usr/lib/python2.4/lib-dynload/time.so
# /usr/lib/python2.4/urlparse.pyc matches /usr/lib/python2.4/urlparse.py
import urlparse # precompiled from /usr/lib/python2.4/urlparse.pyc
import curses # directory /usr/lib/python2.4/curses
# /usr/lib/python2.4/curses/__init__.pyc matches /usr/lib/python2.4/curses/__init__.py
import curses # precompiled from /usr/lib/python2.4/curses/__init__.pyc
dlopen(“/usr/lib/python2.4/lib-dynload/_curses.so”, 2);
import _curses # dynamically loaded from /usr/lib/python2.4/lib-dynload/_curses.so
# /usr/lib/python2.4/curses/wrapper.pyc matches /usr/lib/python2.4/curses/wrapper.py
import curses.wrapper # precompiled from /usr/lib/python2.4/curses/wrapper.pyc
# /usr/lib/python2.4/traceback.pyc matches /usr/lib/python2.4/traceback.py
import traceback # precompiled from /usr/lib/python2.4/traceback.pyc
# /usr/lib/python2.4/getopt.pyc matches /usr/lib/python2.4/getopt.py
import getopt # precompiled from /usr/lib/python2.4/getopt.pyc
http://www.fr3nd.net/stuff/projects/apache-top/apache-top.py
Link gives an Internal Server Error
The internal Server Error has been fixed. Sorry for the inconvenience! :)
Maybe this is a dumb question, but is it “/server-status” dir suppose to exist? Does apache creates it when ExtendedStatus is On? Or what this folder should contain or what does apache-top is looking for in here?
Thank you,
Support for apache 2.2 would be nice :)
I am getting this error – does anybody know why?
# ./apache-top.py -u http://localhost/server-status
File “./apache-top.py”, line 141
print main.__doc__
^
SyntaxError: invalid syntax
Is there any chance of support for Apache 2.2? All I get is “ERROR parsing the data.”
It works with apache 2.2 with no problem, just be sure to turn on extended status and use good url. Try it i.e. with links
We have the same problem as DOCENTA. Yes we using Apache 2 and yes URL in browser is working fine.
What means .0867% CPU load?
Same issue as DOCENTA and Papak: http://localhost/server-status works fine in Lynx, but not in apache-top.py.
Apache 2.2, ExtendedStatus set to On and working, Python 2.5.2.
Any ideas?
“ERROR parsing the data. Please, make sure you are alowed to read the server-status page and you have ExtendedStatus flag activated”
same here with apache 2.2.
any solution?
Thanks for this project its great..
What we need for update is -
spacebar refresh
Also, is their a active thread or mailing list for people working on this project?