Pandora FMS Community

Help debugging plugin ?

JonRussell · 3 ene 2019, 3:41 · 4 mensajes · 79 visitas

  1. Inicio del debate

    Hi, I'm trying to get a plugin working. I downloaded the mySQL Monitoring module from here : https://pandorafms.com/library/mysql-performance-plugin/ The original script had a few typos and errors, and I fixed it so it returns 0 when it exited and it outputs XML Correctly. I put the script in /etc/pandora/plugins/mysql_plugin ran :

    
    chmod +x /etc/pandora/plugins/mysql_plugin
    chown pandora:root /etc/pandora/plugins/mysql_plugin
    

    then vi /etc/pandora/pandora_agent.conf and added  :

    
    # Plugin for mySQL monitoring
    module_plugin mysql_plugin 'pandora' 'PASSWORD'
    

    when I run the script ./mysql_plugin, it outputs a stream of XML, which looks correct, and exits 0. However, when I restart the daemon, no data appears in the server. I turned on debugging, and the data is not in the data file in the /tmp directory either. So, I created a "jon_test" plugin which just output one piece of data, and that works. How can I debug whats going wrong with the mysql plugin ? What types of things would make the daemon fail to include the output in the data it sends ?

    
    [root plugins]# cat /var/log/pandora/pandora_agent.log      
    2019/01/02 23:24:25 - [log] - Running as user root
    2019/01/02 23:24:25 - [setup] - server_ip is 172.21.22.14
    2019/01/02 23:24:25 - [setup] - server_path is /var/spool/pandora/data_in
    2019/01/02 23:24:25 - [setup] - temporal is /tmp
    2019/01/02 23:24:25 - [setup] - logfile is /var/log/pandora/pandora_agent.log
    2019/01/02 23:24:25 - [setup] - interval is 300
    2019/01/02 23:24:25 - [setup] - debug is 1
    2019/01/02 23:24:25 - [setup] - udp_server is 0
    2019/01/02 23:24:25 - [setup] - udp_server_port is 41122
    2019/01/02 23:24:25 - [setup] - udp_server_auth_address is 0.0.0.0
    2019/01/02 23:24:25 - [setup] - agent_name is XXXXXX
    2019/01/02 23:24:25 - [setup] - agent_name_cmd is __rand__
    2019/01/02 23:24:25 - [setup] - agent_alias is XXXXXX
    2019/01/02 23:24:25 - [setup] - group is Servers
    2019/01/02 23:24:25 - [setup] - address is auto
    2019/01/02 23:24:25 - [setup] - server_port is 41121
    2019/01/02 23:24:25 - [setup] - transfer_mode is tentacle
    2019/01/02 23:24:25 - [setup] - remote_config is 0
    2019/01/02 23:24:25 - [setup] - xml_buffer is 1
    2019/01/02 23:24:25 - [setup] - temporal_min_size is 1024
    2019/01/02 23:24:25 - [setup] - ehorus_conf is /etc/ehorus/ehorus_agent.conf
    2019/01/02 23:24:25 - [log] - Thread is disabled.
    2019/01/02 23:24:26 - [debug] - Executing module CPU Load (vmstat 1 2 | tail -1 | awk '{ print $13 }' 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module CPU IOWait (vmstat 1 2 | tail -1 | awk '{ print $16 }' 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module Load Average (cat /proc/loadavg | cut -d' ' -f1 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module TCP_Connections (netstat -an | grep tcp | grep -v LIST | wc -l 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_df_used
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_mem_used
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_netusage
    2019/01/02 23:24:27 - [debug] - Executing plugin: mysql_plugin
    2019/01/02 23:24:27 - [debug] - Executing plugin: jontest1
    2019/01/02 23:24:27 - [debug] - Wrote XML data file '/tmp/TeesCottage.1546471467.data'
    

    jontest1 just does this :

    
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    

    but the mysql_plugin does not. The first few rows of mysql_plugin outputs this, when run on the command line:

    
    [root plugins]# ./mysql_plugin
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ]>
    
    
    
    
    
    

    which all looks correct ? Help ? Thanks, Jon.

  2. Hi, I'm trying to get a plugin working. I downloaded the mySQL Monitoring module from here : https://pandorafms.com/library/mysql-performance-plugin/ The original script had a few typos and errors, and I fixed it so it returns 0 when it exited and it outputs XML Correctly. I put the script in /etc/pandora/plugins/mysql_plugin ran :

    
    chmod +x /etc/pandora/plugins/mysql_plugin
    chown pandora:root /etc/pandora/plugins/mysql_plugin
    

    then vi /etc/pandora/pandora_agent.conf and added  :

    
    # Plugin for mySQL monitoring
    module_plugin mysql_plugin 'pandora' 'PASSWORD'
    

    when I run the script ./mysql_plugin, it outputs a stream of XML, which looks correct, and exits 0. However, when I restart the daemon, no data appears in the server. I turned on debugging, and the data is not in the data file in the /tmp directory either. So, I created a "jon_test" plugin which just output one piece of data, and that works. How can I debug whats going wrong with the mysql plugin ? What types of things would make the daemon fail to include the output in the data it sends ?

    
    [root plugins]# cat /var/log/pandora/pandora_agent.log      
    2019/01/02 23:24:25 - [log] - Running as user root
    2019/01/02 23:24:25 - [setup] - server_ip is 172.21.22.14
    2019/01/02 23:24:25 - [setup] - server_path is /var/spool/pandora/data_in
    2019/01/02 23:24:25 - [setup] - temporal is /tmp
    2019/01/02 23:24:25 - [setup] - logfile is /var/log/pandora/pandora_agent.log
    2019/01/02 23:24:25 - [setup] - interval is 300
    2019/01/02 23:24:25 - [setup] - debug is 1
    2019/01/02 23:24:25 - [setup] - udp_server is 0
    2019/01/02 23:24:25 - [setup] - udp_server_port is 41122
    2019/01/02 23:24:25 - [setup] - udp_server_auth_address is 0.0.0.0
    2019/01/02 23:24:25 - [setup] - agent_name is XXXXXX
    2019/01/02 23:24:25 - [setup] - agent_name_cmd is __rand__
    2019/01/02 23:24:25 - [setup] - agent_alias is XXXXXX
    2019/01/02 23:24:25 - [setup] - group is Servers
    2019/01/02 23:24:25 - [setup] - address is auto
    2019/01/02 23:24:25 - [setup] - server_port is 41121
    2019/01/02 23:24:25 - [setup] - transfer_mode is tentacle
    2019/01/02 23:24:25 - [setup] - remote_config is 0
    2019/01/02 23:24:25 - [setup] - xml_buffer is 1
    2019/01/02 23:24:25 - [setup] - temporal_min_size is 1024
    2019/01/02 23:24:25 - [setup] - ehorus_conf is /etc/ehorus/ehorus_agent.conf
    2019/01/02 23:24:25 - [log] - Thread is disabled.
    2019/01/02 23:24:26 - [debug] - Executing module CPU Load (vmstat 1 2 | tail -1 | awk '{ print $13 }' 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module CPU IOWait (vmstat 1 2 | tail -1 | awk '{ print $16 }' 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module Load Average (cat /proc/loadavg | cut -d' ' -f1 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module TCP_Connections (netstat -an | grep tcp | grep -v LIST | wc -l 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_df_used
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_mem_used
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_netusage
    2019/01/02 23:24:27 - [debug] - Executing plugin: mysql_plugin
    2019/01/02 23:24:27 - [debug] - Executing plugin: jontest1
    2019/01/02 23:24:27 - [debug] - Wrote XML data file '/tmp/TeesCottage.1546471467.data'
    

    jontest1 just does this :

    
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    

    but the mysql_plugin does not. The first few rows of mysql_plugin outputs this, when run on the command line:

    
    [root plugins]# ./mysql_plugin
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <![CDATA]>
    
    
    
    
    
    

    which all looks correct ? Help ? Thanks, Jon.

    Hello JonRussell, Try to put this in the agent configuration:

    module_plugin /etc/pandora/plugins/mysql_plugin 'pandora' 'PASSWORD'
    

    And then restart the agent daemon. Tell me if it works. Regards

  3. Fix it ! :-( my plugin was never being run !! There is a script /usr/bin/mysql_plugin which is part of the MariaDB package. So adding :

    
    # Plugin for mySQL monitoring
    module_plugin mysql_plugin
    

    to the /etc/pandora/pandora_agent.conf file was running the wrong script !!! :-( I have renamed the plugin in the panadora plugin directory to pandora_mysql_plugin and updated the conf file and its all working! ... too many hours I spent down this rabbit hole. :-( Jon.

  4. Hi, I'm trying to get a plugin working. I downloaded the mySQL Monitoring module from here : https://pandorafms.com/library/mysql-performance-plugin/ The original script had a few typos and errors, and I fixed it so it returns 0 when it exited and it outputs XML Correctly. I put the script in /etc/pandora/plugins/mysql_plugin ran :

    
    chmod +x /etc/pandora/plugins/mysql_plugin
    chown pandora:root /etc/pandora/plugins/mysql_plugin
    

    then vi /etc/pandora/pandora_agent.conf and added  :

    
    # Plugin for mySQL monitoring
    module_plugin mysql_plugin 'pandora' 'PASSWORD'
    

    when I run the script ./mysql_plugin, it outputs a stream of XML, which looks correct, and exits 0. However, when I restart the daemon, no data appears in the server. I turned on debugging, and the data is not in the data file in the /tmp directory either. So, I created a "jon_test" plugin which just output one piece of data, and that works. How can I debug whats going wrong with the mysql plugin ? What types of things would make the daemon fail to include the output in the data it sends ?

    
    [root plugins]# cat /var/log/pandora/pandora_agent.log      
    2019/01/02 23:24:25 - [log] - Running as user root
    2019/01/02 23:24:25 - [setup] - server_ip is 172.21.22.14
    2019/01/02 23:24:25 - [setup] - server_path is /var/spool/pandora/data_in
    2019/01/02 23:24:25 - [setup] - temporal is /tmp
    2019/01/02 23:24:25 - [setup] - logfile is /var/log/pandora/pandora_agent.log
    2019/01/02 23:24:25 - [setup] - interval is 300
    2019/01/02 23:24:25 - [setup] - debug is 1
    2019/01/02 23:24:25 - [setup] - udp_server is 0
    2019/01/02 23:24:25 - [setup] - udp_server_port is 41122
    2019/01/02 23:24:25 - [setup] - udp_server_auth_address is 0.0.0.0
    2019/01/02 23:24:25 - [setup] - agent_name is XXXXXX
    2019/01/02 23:24:25 - [setup] - agent_name_cmd is __rand__
    2019/01/02 23:24:25 - [setup] - agent_alias is XXXXXX
    2019/01/02 23:24:25 - [setup] - group is Servers
    2019/01/02 23:24:25 - [setup] - address is auto
    2019/01/02 23:24:25 - [setup] - server_port is 41121
    2019/01/02 23:24:25 - [setup] - transfer_mode is tentacle
    2019/01/02 23:24:25 - [setup] - remote_config is 0
    2019/01/02 23:24:25 - [setup] - xml_buffer is 1
    2019/01/02 23:24:25 - [setup] - temporal_min_size is 1024
    2019/01/02 23:24:25 - [setup] - ehorus_conf is /etc/ehorus/ehorus_agent.conf
    2019/01/02 23:24:25 - [log] - Thread is disabled.
    2019/01/02 23:24:26 - [debug] - Executing module CPU Load (vmstat 1 2 | tail -1 | awk '{ print $13 }' 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module CPU IOWait (vmstat 1 2 | tail -1 | awk '{ print $16 }' 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module Load Average (cat /proc/loadavg | cut -d' ' -f1 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing module TCP_Connections (netstat -an | grep tcp | grep -v LIST | wc -l 2> /dev/null)
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_df_used
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_mem_used
    2019/01/02 23:24:27 - [debug] - Executing plugin: pandora_netusage
    2019/01/02 23:24:27 - [debug] - Executing plugin: mysql_plugin
    2019/01/02 23:24:27 - [debug] - Executing plugin: jontest1
    2019/01/02 23:24:27 - [debug] - Wrote XML data file '/tmp/TeesCottage.1546471467.data'
    

    jontest1 just does this :

    
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    echo ""
    

    but the mysql_plugin does not. The first few rows of mysql_plugin outputs this, when run on the command line:

    
    [root plugins]# ./mysql_plugin
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <![CDATA]>
    
    
    
    
    
    

    [size] which all looks correct ? Help ? Thanks, Jon.

    [size] Good afternoon JonRussell, What version of Pandora FMS are you using? Have you tried executing "module_plugin mysql_plugin 'pandora' 'PASSWORD'" command with the complete path where the plugin is?  It could be that it is not executing correctly because it doesn't find it. Best regards, Alberto.

Entra en tu cuenta para publicar.