6. Custom Nagios monitoring items

1, Process Description nagios with a large number of plug-ins, general common services can be downloaded to the plug-in, plug-in also comes with some nagios official website, but did not directly defined, so we need to be manually defined under simple point that is in commands.cfg defined command, if required variables can be defined in resource.cfg (such as database passwords, etc.), and finally add the need to monitor the server configuration files (such as localhost.cfg) corresponding to 2 service, service configuration check_mysql 2.1, commands.cfg arranged in the following order were added last commands.cfg
vi /usr/local/nagios/etc/object/commands.cfg
# 'check_mysql ' command definition
define command{
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u root -p $USER7$
}
2.2, add the following configuration information resource.cfg
vi /usr/local/nagios/etc/resource.cfg
$USER7$=mysqlpass
2.3, mysql monitor configuration localhost.cfg add items
vi /usr/local/nagios/etc/object/localhost.cfg
# 检查远程Linux主机的Mysql服务
define service{
use generic-service
host_name localhost
service_description MySQL
check_command check_mysql
notifications_enabled 0
}
2.4 Test
service nagios restart
Now log in to view the mysql web monitoring items see the following message ok, we're done Uptime: 949983 Threads: 3 Questions: 312804 Slow queries: 0 Opens: 154 Flush tables: 1 Open tables: 64 Queries per second avg: 0.329 3, is a summary nagios money very powerful monitoring tool, as long as our in-depth research, a lot will always try to get what you want in the future if the plug is installed, just download plugins to the / usr / local / nagios / libexec directory and then using the above steps to add monitoring items, some system parameters may require official documentation found out how to call, most of the official plug-ins have given sufficient explanation

Reproduced in: https: //my.oschina.net/766/blog/210968

Guess you like

Origin blog.csdn.net/weixin_34085658/article/details/91546398