cd /usr/local/nagios/etc/objectssudo touch mysql92\1.cfg && sudo chown nagios:nagios mysql91.cfg# add# define a host use template linux-serverdefine host { use linux-server host_name mysql91 alias mysql server 91 address 192.168.0.91}# define a new hostgroupdefine hostgroup { hostgroup_name mysql-server alias mysql-server members mysql91}# define services with template generic-service# mysql_conn_timedefine service { use generic-service host_name mysql91 service_description mysql_conn_time check_command check_mysql_health!192.168.0.91!db!MysqlPasswd2019!3306!connection-time!}# mysql_threads_connecteddefine service { use generic-service host_name mysql91 service_description mysql_threads_connected check_command check_mysql_health!192.168.0.91!db!MysqlPasswd2019!3306!threads-connected!}# mysql_slow_queriesdefine service { use generic-service host_name mysql91 service_description mysql_slow_queries check_command check_mysql_health!192.168.0.91!db!MysqlPasswd2019!3306!slow-queries!}# mysql_encdedefine service { use generic-service host_name mysql91 service_description mysql_sql check_command check_mysql_health!192.168.0.91!db!MysqlPasswd2019!3306!encode!}# mysql_open_filesdefine service { use generic-service host_name mysql91 service_description mysql_open_files check_command check_mysql_health!192.168.0.91!db!MysqlPasswd2019!3306!open-files!}复制代码