cd /usr/local/nagios/etc/objects
vim localhost.cfg
define host{
use linux-server
host_name localhost
alias localhost
address 127.0.0.1
}
# Define an optional hostgroup for Linux machines
define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost ; Comma separated list of hosts that belong to this group
}
# Define a service to "ftp" the local machine
define service{
use local-service ; Name of service template to use
host_name localhost
service_description FTP
check_command check_ftp
}
# Define a service to "nfs" the local machine
define service{
use local-service ; Name of service template to use
host_name localhost
service_description NFS
check_command check_tcp!2049
}
监控远程主机
==============================================================================
cd /usr/local/nagios/etc/objects
cp localhost.cfg 192.168.0.164.cfg
vim 192.168.122.100
define host{
use linux-server
host_name testserver
alias host196
address 192.168.122.100
}
#define hostgroup{
# hostgroup_name testserver ; The name of the hostgroup
# alias host; Long name of the group
# members localhost ; Comma separated list of hosts that belong to this group
#}
define service{
use local-service
host_name testserver
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use local-service
host_name testserver
service_description HTTP
check_command check_http
# notifications_enabled 0
}
define service{
use local-service
host_name testserver
service_description NFS
check_command check_tcp!2049
# notifications_enabled 0
}
=============================================================================
更改主配置文件
vim /usr/local/nagios/etc/nagios.cfg
添加一行
cfg_file=/usr/local/nagios/etc/objects/192.168.122.100.cfg
检测新的配置文件是否正确
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
=============================================================================
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。