Plugin check_mysqld.pl

  • Hello,


    After some hours of work and reading documentation, my Icinga server works well. Last release on a Ubuntu 12.10 server 64bits, NRPE, IDO2DB and pnp4Nagios are installed and all is good.


    I've installed some plugins for hosts I monitor and all works fine.


    I have only one problem with the plugin mysqld.pl that I found here: http://exchange.nagios.org/dir…ySQL/check_mysqld/details


    I am really lost to install this plugin. It comes with a custom template and a php script. Is someone can give me some baseline to configure it? I am not sure to know where to put the template file for this plugin and how to configure it...


    I am interrested for help, tutorial, or another plugin to graph perfdata mysql...


    Thanks in advance.

  • Hi, thanks for the answer.


    I'd like to use the others file to have graph, it is the problem :).

  • The post subject and

    I am really lost to install this plugin


    told me that you are not able to use the plugin. Anyway...


    If you read my first answer - which information from your side could be the most important for answering the question about the right configuation file? ;)


    Simon

  • Sorry for my bad english.


    I am going to explain better my problem.


    The objective: To have nice graphs from the plugin, exactly like that : http://exchange.nagios.org/directory/image/1061


    Where I am and What I've done:
    ---------------------------------------


    In my mysql server (sql3), this is what I've put in /etc/nagios/nrpe.cfg for the plugin:


    command[check_mysqld.pl]=sudo /usr/lib/nagios/plugins/check_mysqld.pl -H localhost -u root -f -p password -A Com_insert,Com_select


    My plugin is here on sql3 server:
    root@sql3:/usr/lib/nagios/plugins# ll /usr/lib/nagios/plugins/check_mysqld.pl
    -rwx--x--x 1 root root 27615 Dec 28 12:34 /usr/lib/nagios/plugins/check_mysqld.pl*


    And looks work fine:


    root@sql3:/usr/lib/nagios/plugins# ./check_mysqld.pl -H localhost -u root -f -p password -A Com_insert,Com_select
    MYSQL 5.5.28-0ubuntu0.12.10.1-log OK | com_insert=356234 com_select=146753


    I see in my /var/log/syslog:


    Dec 28 14:12:18 sql3 nrpe[24323]: Connection from 10.17.9.12 port 10675
    Dec 28 14:12:18 sql3 nrpe[24323]: Host address is in allowed_hosts
    Dec 28 14:12:18 sql3 nrpe[24323]: Handling the connection...
    Dec 28 14:12:18 sql3 nrpe[24323]: Host is asking for command 'check_mysqld.pl' to be run...
    Dec 28 14:12:18 sql3 nrpe[24323]: Running command: sudo /usr/lib/nagios/plugins/check_mysqld.pl -H localhost -u root -f -p x32y64=128z -A Com_insert,Com_select
    Dec 28 14:12:18 sql3 nrpe[24323]: Command completed with return code 0 and output: MYSQL 5.5.28-0ubuntu0.12.10.1-log OK | com_insert=356234 com_select=146751
    Dec 28 14:12:18 sql3 nrpe[24323]: Return Code: 0, Output: MYSQL 5.5.28-0ubuntu0.12.10.1-log OK | com_insert=356234 com_select=146751
    Dec 28 14:12:18 sql3 nrpe[24323]: Connection from 10.17.9.12 closed.


    Perfect.


    In my Icinga server, this is what I've done:


    I've add in my /etc/icinga/resource.cfg this:


    $USER21$='com_commit,com_rollback,com_delete,com_update,com_insert,com_insert_select,com_select,qcache_hits,qcache_inserts,qcache_not_cached,questions,bytes_sent,bytes_received,aborted_clients,
    aborted_connects,binlog_cache_disk_use,binlog_cache_use,connections,created_tmp_disk_tables,created_tmp_files,created_tmp_tables,delayed_errors,delayed_insert_threads,delayed_writes,handler_update,
    handler_write,handler_delete,handler_read_first,handler_read_key,handler_read_next,handler_read_prev,handler_read_rnd,handler_read_rnd_next,key_blocks_not_flushed,key_blocks_unused,key_blocks_used,
    key_read_requests,key_reads,key_write_requests,key_writes,max_used_connections,not_flushed_delayed_rows,open_files,open_streams,open_tables,opened_tables,prepared_stmt_count,qcache_free_blocks,
    qcache_free_memory,qcache_lowmem_prunes,qcache_queries_in_cache,qcache_total_blocks,select_full_join,select_rangle_check,slow_launch_threads,slow_queries,table_locks_immediate,table_locks_waited,
    threads_cached,threads_connected,threads_created,threads_running'


    In my /etc/icinga/objects/sql3.cfg I have:


    define service{
    use generic-service
    host_name sql3
    service_description Mysql-select
    check_command check_nrpe_1arg!check_mysqld.pl
    }


    and in my /etc/icinga/commands.cfg I have:


    define command{
    command_name check_mysqld.pl
    command_line $USER1$/check_mysqld.pl -H $HOSTADDRESS$ -u nagios -p $USER7$ -a uptime,threads_connected,questions,slow_queries,open_tables -w ',,,,' -c ',,,,' -A $USER21$
    }


    I have put check_mysqld.php and check_mysqld.cfg in /etc/pnp4nagios/templates and templates.d


    The problem now:
    ----------------------


    It displays some grpahs, but they are wrong, look attachment. I think I've do not understand something about configuration on pnp4nagios and the plugin template.


    Is there a way to obtain some help and explain me what I did wrong?


    Thanks in advance.

  • $USER21$='com_commit,com_rollback,com_delete,com_update,com_insert,com_insert_select,com_select,qcache_hits,qcache_inserts,qcache_not_cached,questions,bytes_sent,bytes_received,aborted_clients,
    aborted_connects,binlog_cache_disk_use,binlog_cache_use,connections,created_tmp_disk_tables,created_tmp_files,created_tmp_tables,delayed_errors,delayed_insert_threads,delayed_writes,handler_update,
    handler_write,handler_delete,handler_read_first,handler_read_key,handler_read_next,handler_read_prev,handler_read_rnd,handler_read_rnd_next,key_blocks_not_flushed,key_blocks_unused,key_blocks_used,
    key_read_requests,key_reads,key_write_requests,key_writes,max_used_connections,not_flushed_delayed_rows,open_files,open_streams,open_tables,opened_tables,prepared_stmt_count,qcache_free_blocks,
    qcache_free_memory,qcache_lowmem_prunes,qcache_queries_in_cache,qcache_total_blocks,select_full_join,select_rangle_check,slow_launch_threads,slow_queries,table_locks_immediate,table_locks_waited,
    threads_cached,threads_connected,threads_created,threads_running'


    Did you understand the meaning of the parameter -A?

    Quote

    -A, --perfvars=STRING,[STRING,[STRING...]]
    This allows to list variables which values will go only into perfparse
    output (and not for threshold checking). A special value of '*' allows
    to output all variables from 'SHOW STATUS' or 'SHOW GLOBAL STATUS'.


    "slow queries", for example, is mentioned in -a and -A. That does not make much sense. Either you want to check thresholds or not....



    define command{
    command_name check_mysqld.pl
    command_line $USER1$/check_mysqld.pl -H $HOSTADDRESS$ -u nagios -p $USER7$ -a uptime,threads_connected,questions,slow_queries,open_tables -w ',,,,' -c ',,,,' -A $USER21$
    }


    ",,,," for warning and critical thresholds won't work at all. This is a comma separated list of threshold values which number and order must be the same as the values specified with -a :

    Quote

    -w, --warn=STR[,STR[,STR[..]]]
    This option can only be used if '--variables' (or '-a') option above
    is used and number of values listed here must exactly match number
    of variables specified with '-a'. The values specify warning threshold
    for when Nagios should send WARNING alert. These values are usually
    numbers and can have the following prefix modifiers:


    Regards,
    Simon