Pandora FMS community forums

Full Version: Modulo Apache CPULoad no inicializado
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Buenas tardes,

alguna idea al respecto ? No consigo ponerlo en marcha.

Muchas gracias.

Saludos,

Félix
Buenas,

he conseguido configurar el servidor que está corriendo Apache. He realizado las siguientes modificaciones en el fichero /etc/httpd/conf/httpd.conf

ExtendedStatus On

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Allow from all
</Location>

he reiniciado el servicio apache  service httpd restart

Después desde un navegador web pongo la dirección

http://servidor/server-status veo la siguiente información

Apache Server Status for harrapatu

Server Version: Apache
Server Built: Oct 20 2011 17:00:12

Current Time: Friday, 04-Nov-2011 07:05:09 CET
Restart Time: Friday, 04-Nov-2011 06:56:22 CET
Parent Server Generation: 0
Server uptime: 8 minutes 47 seconds
Total accesses: 109 - Total Traffic: 312 kB
CPU Usage: u1.06 s.07 cu0 cs0 - .214% CPU load
.207 requests/sec - 606 B/second - 2931 B/request
3 requests currently being processed, 12 idle workers

K___W________K_.................................................
................................................................
................................................................
................................................................

Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process

Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-0 20335 3/27/27 K 0.18 1 1 5.8 0.06 0.06 172.16.20.70 *.midominio.com GET /tdqm_pixel.gif HTTP/1.1
1-0 20336 0/22/22 _ 0.38 16 2 0.0 0.08 0.08 172.16.20.70 *.midominio.com GET /login.php HTTP/1.1
2-0 20337 0/8/8 _ 0.00 1 1 0.0 0.02 0.02 172.16.40.71 *.midominio.com GET /tdqm_pixel.gif HTTP/1.1
3-0 20338 0/5/5 _ 0.00 0 1 0.0 0.02 0.02 172.16.20.70 *.midominio.com GET /img/buscar.gif HTTP/1.1
4-0 20339 0/8/8 W 0.04 0 0 0.0 0.02 0.02 172.16.100.198 harrapatu.midominio.local GET /server-status HTTP/1.1
5-0 20340 0/4/4 _ 0.09 61 445 0.0 0.02 0.02 172.16.20.70 *.midominio.com GET /projects.php?from=tiemposProyecto HTTP/1.1
6-0 20341 0/2/2 _ 0.00 7 1 0.0 0.00 0.00 172.16.40.71 *.midominio.com GET /tdqm_pixel.gif HTTP/1.1
7-0 20342 0/11/11 _ 0.09 1 33 0.0 0.03 0.03 172.16.40.71 *.midominio.com GET /tiemposProyecto.php?maquina=3201 HTTP/1.1
8-0 20682 0/3/3 _ 0.00 17 1 0.0 0.00 0.00 172.16.20.70 *.midominio.com GET /tdqm_pixel.gif HTTP/1.1
9-0 20683 0/11/11 _ 0.19 11 1 0.0 0.04 0.04 172.16.40.74 *.midominio.com GET /tdqm_pixel.gif HTTP/1.1
10-0 20684 0/1/1 _ 0.02 17 618 0.0 0.00 0.00 172.16.40.71 *.midominio.com POST /login.php HTTP/1.1
11-0 20685 0/1/1 _ 0.03 17 34 0.0 0.00 0.00 172.16.40.71 *.midominio.com GET /tiemposProyecto.php HTTP/1.1
12-0 20686 0/1/1 _ 0.00 17 2 0.0 0.00 0.00 172.16.40.71 *.midominio.com GET /tdqm_pixel.gif HTTP/1.1
13-0 20687 4/4/4 K 0.08 2 1 10.5 0.01 0.01 172.16.40.74 *.midominioi.com GET /tdqm_pixel.gif HTTP/1.1
14-0 20688 0/1/1 _ 0.03 7 36 0.0 0.00 0.00 172.16.40.71 *.midominio.com GET /tiemposProyecto.php?tarea=PRENSA&opDeMaquina=si HTTP/1.1
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot
SSL/TLS Session Cache Status:
cache type: SHMCB, shared memory: 512000 bytes, current sessions: 4
sub-caches: 32, indexes per sub-cache: 133
time left on oldest entries' SSL sessions: avg: 182 seconds, (range: 58...281)
index usage: 0%, cache usage: 0%
total sessions stored since starting: 4
total sessions expired since starting: 0
total (pre-expiry) sessions scrolled out of the cache: 0
total retrieves since starting: 17 hit, 2 miss
total removes since starting: 0 hit, 0 miss

Pero en Pandora me siguen apareciendo los módulos:

Apache CPULoad
Busy Workers
BytesPerSecond Served
Total Accesses

sin inicializar.

Alguna idea o ayuda ?

Muchas gracias.

Saludos,

Félix
Buenas,

¿Cómo estás creando esos módulos? Supongo que estarás utilizando un plugin de agente. Échale un vistazo a esta url:

http://openideas.info/wiki/index.php?tit...es:Apache2

De todas formas, la conexión se tiene que hacer a la url que pongo abajo, ya que la información se saca de aquí de esta info que se muestra:

Code:
http://servidor/server-status?auto

Saludos.

Hola Luismi,

miro y os digo algo.

Muchas gracias.

Saludos,

Félix
Luismi,

sí, estoy usando el plugin.

Esa url dónde la tengo que poner ? En el fichero httpd.conf del servidor Apache a controlar ?

Muchas gracias.

Saludos,

Félix
Hola Luismi,

ya lo he visto. El plugin donde va en el servidor pandora ó en el servidor a controlar ?

Muchas gracias.

Saludos,

Félix
Buenas,

no hay nada como prueba error. Plugin colocado en el servidor a controlar. y modificado el plugin de la siguiente forma:

Code:
#!/bin/bash

# This is an Agent plugin for Pandora FMS 2.x or higher
# Collect information for apache using a netcat (nc) tool
# and requires to have Apache configured to accept server-status request
# Just invoke from Pandora Agent as
#
# module_plugin apache
#
# This has been tested with Apache 2.2.13 (SUSE). Should work with other versions
# with some modifications

ASTAT="`echo -e 'GET http://harrapatu/server-status?auto HTTP/1.0\n\n' | nc -w 30 localhost 80`"
FSTAT="`echo -e 'GET http://harrapatu/server-status?auto HTTP/1.0\n\n' | nc -w 30 localhost 80`"
AF_CPULOAD=`echo $FSTAT  | grep -o "CPU Usage: u[0-9]" | awk '{ print $3 }' | grep -o "[0-9\.]*"`
AP_REQSEC=`echo $ASTAT | grep -o "ReqPerSec: [0-9.]*" | awk '{ print $2}'`
AP_TOTACC=`echo $ASTAT | grep -o "Total Accesses: [0-9]*" | awk '{ print $3}'`
AP_BUSY=`echo $ASTAT | grep -o "BusyWorkers: [0-9]*" | awk '{ print $2}'`
AP_BPS=`echo $ASTAT | grep -o "BytesPerSec: [0-9]*" | awk '{ print $2}'`

echo "<module>"
echo "<name>Total Accesses</name>"
echo "<type>generic_data_inc</type>"
echo "<data>$AP_TOTACC</data>"
echo "</module>"

echo "<module>"
echo "<name>Request per second</name>"
echo "<type>generic_data</type>"
echo "<data>0$AP_REQSEC</data>"
echo "</module>"

echo "<module>"
echo "<name>Busy Workers</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_BUSY</data>"
echo "</module>"

echo "<module>"
echo "<name>BytesPerSecond Served</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_BPS</data>"
echo "</module>"

echo "<module>"
echo "<name>Apache CPULoad</name>"
echo "<type>generic_data</type>"
echo "<data>$AF_CPULOAD</data>"
echo "</module>"

siendo harrapatu la máquina a controlar.

Muchas gracias por vuestra ayuda y paciencia.

Sigo siendo torpe ;-)

Saludos,

Félix
Jajajajajaja, no hay felicidad absoluta. El único dato que no muestra correctamente es :

Total Accesses

Code:
# Collect information for apache using a netcat (nc) tool
# and requires to have Apache configured to accept server-status request
# Just invoke from Pandora Agent as
#
# module_plugin apache
#
# This has been tested with Apache 2.2.13 (SUSE). Should work with other versions
# with some modifications

ASTAT="`echo -e 'GET http://localhost/server-status?auto HTTP/1.0\n\n' | nc -w 30 localhost 80`"
FSTAT="`echo -e 'GET http://localhost/server-status?auto HTTP/1.0\n\n' | nc -w 30 localhost 80`"
AP_CPULOAD=`echo $ASTAT | grep -o "CPULoad: [0-9.]*" | awk '{ print $2 }'`
AP_REQSEC=`echo $ASTAT | grep -o "ReqPerSec: [0-9.]*" | awk '{ print $2 }'`
AP_TOTACC=`echo $ASTAT | grep -o "Total Accesses: [0-9]*" | awk '{ print $3 }'`
AP_BUSY=`echo $ASTAT | grep -o "BusyWorkers: [0-9]*" | awk '{ print $2 }'`
AP_BPS=`echo $ASTAT | grep -o "BytesPerSec: [0-9]*" | awk '{ print $2 }'`

echo "<module>"
echo "<name>Total Accesses</name>"
echo "<type>generic_data_inc</type>"
echo "<data>$AP_TOTACC</data>"
echo "<description>Accesos totales</description>"
echo "</module>"

echo "<module>"
echo "<name>Request per second</name>"
echo "<type>generic_data</type>"
echo "<data>0$AP_REQSEC</data>"
echo "<description>Peticiones por segundo</description>"
echo "</module>"

echo "<module>"
echo "<name>Busy Workers</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_BUSY</data>"
echo "</module>"

echo "<module>"
echo "<name>BytesPerSecond Served</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_BPS</data>"
echo "<description>Bytes por segundo servidos</description>"
echo "</module>"

echo "<module>"
echo "<name>Apache CPULoad</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_CPULOAD</data>"
echo "<description>Carga de CPU por Apache</description>"
echo "</module>"

muestra 0 siempre.

Si en el servidor ejecuto
Code:
echo $ASTAT | grep -o "Total Accesses: [0-9]*" | awk '{ print $3 }'
muestra el dato correctamente.

Alguna idea ?

Muchas gracias.

Saludos,

Félix
Buenos días,

alguna sugerencia con el módulo Total accesses ? No consigo que me devuelva el valor correcto en Pandora, siempre me devuelve 0. En la máquina linux con los comandos devuelve el valor correctamente.

Muchas gracias.

Saludos,

Félix
Buenas,

os adjunto la imagen con el 0 en Total Acceses y la del sistema operativo.

Muchas gracias.

Saludos,

Félix

Pages: 1 2