nagios监控本机及远程机器-创新互联
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
=============================================================================
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享标题:nagios监控本机及远程机器-创新互联
链接分享:http://pwwzsj.com/article/pddod.html