The nagios graphic interface is still quite troublesome. Let's take mysql as an example. There are many plug-ins for monitoring mysql. Here we will learn about the method, instead of moving hard. 1. Install pnp4nagios refer to nagiospnp4nagios installation configuration 2. Install perlmysql extension # yuminstallperl-Class-DBI-mysql III, check_mysql
The nagios graphic interface is still quite troublesome. Let's take mysql as an example. There are many plug-ins for monitoring mysql. Here we will learn about the method, instead of moving hard. 1. install pnp4nagios refer to: nagios pnp4nagios installation configuration 2. install perl mysql extension # yum install perl-Class-DBI-mysql III, check_mysql
The nagios graphic interface is still quite troublesome. Let's take mysql as an example. There are many plug-ins for monitoring mysql. Here we will learn about the method, instead of moving hard.
1. Install pnp4nagios
See:Nagios pnp4nagios installation Configuration
Ii. Install perl mysql extension
# yum install perl-Class-DBI-mysql
Iii. check_mysqld.php and check_mysqld.pl
1. Download
Http://exchange.nagios.org/components/com_mtree/attachment.php? Link_id = 174 & cf_id = 30
Http://exchange.nagios.org/components/com_mtree/attachment.php? Link_id = 174 & cf_id = 36
2. Modify check_mysqld.php and check_mysqld.pl. The local machine is 64-bit and there is no/usr/lib/nagios at all. Therefore, change the lib in the file to lib64.
3. copy and modify File Permissions
# cp check_mysqld.pl /usr/lib64/nagios/plugins# chmod 755 /usr/lib64/nagios/plugins/check_mysqld.pl# chgrp nagios /usr/lib64/nagios/plugins/check_mysqld.pl# cp check_mysqld.php /usr/share/nagios/html/pnp4nagios/templates.dist
4. nagios Configuration
1. modify command. cfg.
# vim /etc/nagios/objects/commands.cfgdefine command{ command_name check_mysqld 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$}
2. Modify resource. cfg.
# vim /etc/nagios/private/resource.cfg $USER7$=nagios$USER21$='com_select,com_update,com_insert,com_insert_select,com_commit,com_delete,com_rollback,aborted_clients,aborted_connects,binlog_cache_disk_use,binlog_cache_use,bytes_received,bytes_sent,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_hits,qcache_inserts,qcache_lowmem_prunes,qcache_not_cached,qcache_queries_in_cache,qcache_total_blocks,questions,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'
Note that the content after $ USER21 $ must be in a row.
3. Modify localhost. cfg.
# Vim/etc/nagios/objects/localhost. cfg define service {use local-service, replace srv-pnp // srv-pnp with your custom host_name localhost service_description MYSQLD check_command check_mysqld! Localhost! Nagios! Nagios}
4. Add check_mysqld.cfg to pnp4nagios.
# vim /etc/pnp4nagios/check_commands/check_mysqld.cfgDATATYPE = COUNTER
5. Restart nagios
# /etc/init.d/npcd restart# /etc/init.d/nrpe restart# /etc/init.d/nagios restart
6. view the results
Nagios mysql
It can be seen that the configuration of graph monitoring mysql in nagios is OK. If there is no data-nan, don't worry. Wait a while and there will be data.
Original article address: nagios pnp4nagios graphic monitoring mysql. Thank you for sharing it with me.