Pandora FMS Community

apache_plugin

algarca · 21 mar 2018, 0:10 · 4 mensajes · 49 visitas

  1. Inicio del debate

    Hola a todos, estoy empezando con Pandora FMS, para un pequeño proyecto; estoy probando con un Turnkey Lamp para que me sirva los datos del server-status de apache, he habilitado el servidor de apache para que muestre el estado del servidor al localhost, al servidor de pandora y a otra ip del equipo anfitrión (me muestra el estado correctamente), buscando por los plugins disponibles en la web (El contenido ya no está disponible) he descargado el plugin, lo he puesto en /etc/pandora/plugins y lo he llamado desde el fichero de configuración de agente como indica; pero a la hora de que muestre los datos en el servidor de pandora, los módulos aparecen como no inicializados y los dos unicos que me aparecen como inicializados, aparecen a cero. Alguien me podría dar alguna indicación para hacer que funcione. Muchas gracias de antemano adjunto el fichero de configuración del plugin #!/bin/bash # Apache monitorization plugin for Pandora FMS agent # Author: Manuel A. Gulín Bejarano # Version: 1.1 # Date: 19/03/2013 # # This program is free software: you can redistribute it and/or modify #  it under the terms of the GNU General Public License as published by #  the Free Software Foundation, either version 3 of the License, or #  (at your option) any later version. # # This program is distributed in the hope that it will be useful, #  but WITHOUT ANY WARRANTY; without even the implied warranty of #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the #  GNU General Public License for more details. # # You should have received a copy of the GNU General Public License #  along with this program.  If not, see . function help {         echo -e "Apache monitorization agent plugin for Pandora FMS agent. http://pandorafms.com"         echo -e "Apache need the server status module active and accessible from localhost without password"         echo -e "Syntax:"         echo -e "tt$0 "         exit } if [ $# -ne 1 ] then         help         exit -1 fi ## Info about server - all retrieved with one query, later it's going to be appropiately parsed ASTAT="`wget -q -O - "$@" --no-check-certificate $1?auto`" FSTAT="`wget -q -O - "$@" --no-check-certificate $1`" # Info about CPU usage AF_CPUULOAD=`echo $FSTAT  | grep -o "CPU Usage: u[0-9]*.[0-9]* s[0-9]*.[0-9]*" | awk '{print $3}' | cut -d"u" -f2 | tail --lines=1` AF_CPUSLOAD=`echo $FSTAT  | grep -o "CPU Usage: u[0-9]*.[0-9]* s[0-9]*.[0-9]*" | awk '{print $4}' | cut -d"s" -f2 | tail --lines=1` # Info about performance AP_REQSEC=`echo $ASTAT | grep -o "ReqPerSec: [0-9.]*" | awk '{print $2}'` AP_BPS=`echo $ASTAT | grep -o "BytesPerSec: [0-9]*" | awk '{ print $2}'` AP_TOTACC=`echo $ASTAT | grep -o "Total Accesses: [0-9]*" | awk '{print $3}'` # Info about apache processes AP_BUSY=`echo $ASTAT | grep -o "BusyWorkers: [0-9]*" | awk '{print $2}'` AP_IDLE=`echo $ASTAT | grep -o "IdleWorkers: [0-9]*" | awk '{print $2}'` # Info about uptime AP_UPTIME=`echo $ASTAT | grep -o "Uptime: [0-9]*" | grep -o [0-9]*` AF_REBOOT=`echo $FSTAT | grep -o "

    Restart Time: [a-zA-Z]*, [0-9]*-[a-zA-Z]*-[0-9]* [0-9:]* [a-zA-Z]*" | grep -o "[a-zA-Z]*, [0-9]*-[a-zA-Z]*-[0-9]* [0-9:]* [a-zA-Z]*" | tail --lines=1` AF_RELOADS=`echo $FSTAT | grep -o "Parent Server Generation: [0-9]*" | grep -o [0-9]* | tail --lines=1` # Some useful info AP_TOTAL=$((AP_BUSY+AP_IDLE)) AP_TOTAL_MIN_WARN=`echo $AP_TOTAL | awk '{print ($1*0.80)}'` AP_TOTAL_MAX_WARN=`echo $AP_TOTAL | awk '{print ($1*0.89)}'` AP_TOTAL_MIN_CRIT=`echo $AP_TOTAL | awk '{print ($1*0.90)}'` ######################################################################################################### # UPTIME INFO MODULES ######################################################################################################### echo -e "t" echo -e "t" echo -e "t" echo -e "tasync_string" echo -e "t0" echo -e "t0" echo -e "t" #echo -e "t0 * * * *" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t0" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "tasync_data" echo -e "t0" echo -e "t0" echo -e "t" #echo -e "t0 * * * *" echo -e "t" ######################################################################################################### # PERFORMANCE INFO MODULES ######################################################################################################### echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t0" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t0" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t0" echo -e "t" echo -e "t" ######################################################################################################### # CPU USAGE INFO MODULES ######################################################################################################### echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t0" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t0" echo -e "t" echo -e "t" ######################################################################################################### # APACHE PROCESSES INFO MODULES ######################################################################################################### echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t$AP_TOTAL" echo -e "t$AP_TOTAL_MIN_WARN" echo -e "t$AP_TOTAL_MAX_WARN" echo -e "t$AP_TOTAL_MIN_CRIT" echo -e "t$AP_TOTAL" echo -e "t0" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "t" echo -e "tgeneric_data" echo -e "t0" echo -e "t$AP_TOTAL" echo -e "t0" echo -e "t" echo -e "t" ###################################################### Fichero de configuración del pandora_agent.conf # Base config file for Pandora FMS agents # Version 7.0NG.718, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # http://www.pandorafms.com # General Parameters # ================== server_ip     192.168.0.17 server_path     /var/spool/pandora/data_in temporal /tmp logfile /var/log/pandora/pandora_agent.log #include /etc/pandora/pandora_agent_alt.conf #broker_agent name_agent # Interval in seconds, 300 by default interval        300 # Debug mode renames XML in the temp folder and continues running debug         1     # Optional. UDP Server to receive orders from outside # By default is disabled, set 1 to enable # Set port (41122 by default) # Set address to restrict who can order a agent restart (0.0.0.0 = anybody) # udp_server 0 udp_server_port 41122 udp_server_auth_address 0.0.0.0 # By default, agent takes machine name agent_name de42283582a256d66b62288559d67a019d194b27b035ffe8170e6140b82e78eb # To define agent name by specific command, define 'agent_name_cmd'. # (In the following example, agent name is 'hostname_IP') # If set to __rand__ the agent will generate a random name. #agent_name_cmd  LANG=C; /bin/echo -n `hostname`; /bin/echo -n "_"; /bin/echo `/sbin/ifconfig eth0 | /bin/grep 'inet addr' | /usr/bin/awk '{print $2;}' | /usr/bin/cut -d: -f2` agent_name_cmd __rand__ # Group assigned for this agent (descriptive, p.e: Servers) group Servers # address: Enforce to server a ip address to this agent # You can also try to detect the first IP using "auto", for example address auto # Listening TCP port for remote server. By default is 41121 (for tentacle) # if you want to use SSH use 22, and FTP uses 21. server_port    41121 # Transfer mode: tentacle, ftp, ssh or local transfer_mode tentacle # Transfer mode user: Owner of files copied on local transfer mode (default apache) #transfer_mode_user apache # timeout in seconds for file transfer programs execution (30 by default) #transfer_timeout 30 # Server password (Tentacle or FTP). Leave empty for no password (default). #server_pwd mypassword # Set to yes/no to enable/disable OpenSSL support for Tentacle (disabled by default). #server_ssl no # Extra options for the Tentacle client (for example: server_opts -v -r 5). #server_opts # delayed_startup defines number of seconds before start execution # for first time when startup Pandora FMS Agent #delayed_startup 10 # Pandora nice defines priority of execution. Less priority means more intensive execution # A recommended value is 10. 0 priority means no Pandora CPU protection enabled (default) #pandora_nice 0 # Cron mode replace Pandora FMS own task schedule each XX interval seconds by the use # of old style cron. You should add to crontab Pandora FMS agent script to use this mode. # This is disabled by default, and is not recommended.  Use Pandora FMS internal scheduler # is much more safe #cron_mode # If set to 1 allows the agent to be configured via the web console (Only Enterprise version) remote_config 0 # If set to 1 start Drone Agent's Proxy Mode # proxy_mode 1 # Max number of simmultaneus connection for proxy (by default 10) # proxy_max_connection 10 # Proxy timeout (by default 1s) # proxy_timeout 1 # Number of threads to execute modules in parallel #agent_threads 1 # User the agent will run as #pandora_user pandora # Enable or disable XML buffer. # If you are in a secured environment and want to enable the XML buffer you # should consider changing the temporal directory, since /tmp is world writable. xml_buffer 1 # Minimum available bytes in the temporal directory to enable the XML buffer temporal_min_size 1024 # Agent mode: Learn (default), No-learn, Autodisable # agent_mode autodisable # eHorus agent configuration file path: # The agent will create a custom field named eHorusID that contains # the eHorus agent's identifying key ehorus_conf /etc/ehorus/ehorus_agent.conf # Module Definition # ================= # System information # Could change depending on linux distro and vmstat command version module_begin module_name CPU Load module_type generic_data module_interval 1 module_exec vmstat 1 2 | tail -1 | awk '{ print $13 }' module_max 100 module_min 0 module_description User CPU Usage (%) module_min_warning 70 module_max_warning 90 module_min_critical 91 module_max_critical 100 module_unit % module_group System module_end # Could change depending on linux distro and vmstat command version module_begin module_name CPU IOWait module_type generic_data module_interval 1 module_exec vmstat 1 2 | tail -1 | awk '{ print $16 }' module_min_warning 10 module_min_critical 16 module_unit % module_description Too much IOwait means IO bottleneck and performance problems. Check also LoadAVG. module_group System module_end # Get load average module_begin module_name Load Average module_type generic_data module_exec cat /proc/loadavg | cut -d' ' -f1 module_description Average process in CPU (Last minute) module_group System module_end # Basic info about TCP Connection module_begin module_name TCP_Connections module_type generic_data module_exec netstat -an | grep tcp | grep -v LIST | wc -l module_description Total number of TCP connections active module_group Networking module_end # This plugin detects all disk and report used space (%) module_plugin pandora_df_used # This plugin detects system free memory and used swap (in %) module_plugin pandora_mem_used # This plugin will get the network usage (bytes/sec) module_plugin pandora_netusage module_plugin /etc/pandora/plugins/apache_plugin_orignal url=192.168.0.22 Muchas gracias y un saludo.

  2. Buenos días algarca: Puedes probar a ejecutar el plugin en sí, ya que muchos de ellos para que funcionen bien necesitas ejecutar algunos parámetros. Ejemplo: Estamos en la carpeta /etc/pandora/plugins con un plugin llamado hola.pl Prueba a ejecutar ./hola.pl Si tiene alguna opción de parametros, se desplegará una ayuda. Si sigues teniendo dudas o problemas, no dudes en contactar conmigo. Un cordial saludo, fraguas.

  3. Buenos días algarca: Puedes probar a ejecutar el plugin en sí, ya que muchos de ellos para que funcionen bien necesitas ejecutar algunos parámetros. Ejemplo: Estamos en la carpeta /etc/pandora/plugins con un plugin llamado hola.pl Prueba a ejecutar ./hola.pl Si tiene alguna opción de parametros, se desplegará una ayuda. Si sigues teniendo dudas o problemas, no dudes en contactar conmigo. Un cordial saludo, fraguas.

    Buenas tardes fraguas, ante todo agradecerte tu respuesta; tenias razón el parámetro que le había puesto no era el correcto, invocando el plugin desde el pandora_agent "module_plugin /etc/pandora/plugins/apache_plugin_orignal http://localhost/server-status" se inicializan todos los módulos y comienzan a dar los valores. Me he estado complicando y la solución era evidente. Muchas gracias Un saludo algarca.

  4. Buenos días  algarca: Me alegra haberte ayudado. Si en un futuro, tienes dudas o te surge algún problema, no dudes en contactar conmigo. Un cordial saludo, fraguas.

Entra en tu cuenta para publicar.