Welcome 微信登录

首页 / 操作系统 / Linux / VMware Linux下Nagios的基本配置

这次配置主要是了解nagios的工作流程,为以后更为复杂的设置打基础!配置的环境为之前《VMware Linux下Nagios的安装》见 http://www.linuxidc.com/Linux/2011-11/47908.htm 设置出来的[root@localhost ~]# cd /usr/local/nagios/etc/objects/[root@localhost objects]# ll
total 88
-rw-rw-r-- 1 nagios nagios  7716 May 11  2011 commands.cfg(全局的命令的设置档案)
-rw-rw-r-- 1 nagios nagios  2167 Feb 15 04:20 contacts.cfg(联系方式的设置档)
-rw-rw-r-- 1 nagios nagios   305 Feb 15 04:46 host.cfg(对主机的监控设置,本来不存在是自己创建的)
-rw-rw-r-- 1 nagios nagios  5403 May 11  2011 localhost.cfg(本机的监控设置)
-rw-rw-r-- 1 nagios nagios  3124 May 11  2011 printer.cfg(对打印机的监控设置)
-rw-r--r-- 1 root   root    1768 Feb 15 04:36 services.cfg(对主机的服务的监控设置,本来不存在是自己创建的)
-rw-rw-r-- 1 nagios nagios  3293 May 11  2011 switch.cfg(对路由器的监控设置)
-rw-rw-r-- 1 nagios nagios 10812 May 11  2011 templates.cfg(全局的监控模板)
-rw-rw-r-- 1 nagios nagios  3209 May 11  2011 timeperiods.cfg(全局的时间设置)
-rw-rw-r-- 1 nagios nagios  4019 May 11  2011 windows.cfg(对windows主机控制的限制)这里的配置流程是,在全局的配置档案中设置好相应的控制命令(宏的形式),另外在设置相应的监控设置档案的时候,调用全局的配置档案的设置,来完成对主机和服务的监控!下边是一个自己配置的小实例[root@localhost ~]# cd /usr/local/nagios/etc/objects/
[root@localhost objects]# vi host.cfg (设置控制主机)
define host{
        use linux-server(设置监控的主机类型,调用在templates.cfg中有对这种类型的定义)
        host_name web(设置主机的名称)
        alias     nagiosadmin-web(设置别名)
        address   192.168.1.122(主机的地址)
}define host{
        use  linux-server
        host_name   mysql
        alias       nagiosadmin-mysql
        address     192.168.1.122
}define hostgroup{(设置主机组)
        hostgroup_name   sa-servers
        alias   sa servers
        members web,mysql
}
[root@localhost objects]# vi services.cfg (设置控制的服务)
#####################   web   ###########################
define service{
        use                    local-service    //调用templates.cfg中对local-service的定义
        host_name              web      //设置服务对应的主机名
        service_description    PING    //服务的类型
        check_command          check_ping!100.0.20%!500.0.60%   //调用,command.cfg对check_ping的定义
}define service{
        use                     local-service
        host_name               web
        service_description     SSH
        check_command           check_ssh
}define service{
        use                     local-service
        host_name               web
        service_description     SSHD
        check_command           check_tcp!22
}######################   mysql  ########################
define service{
        use                     local-service
        host_name               mysql
        service_description     PING
        check_command           check_ping!100.0.20%!500.0.60%
}
define service{
        use                     local-service
        host_name               mysql
        service_description     SSH
        check_command           check_ssh
}
define service{
        use                     local-service
        host_name               mysql
        service_description     ftp
        check_command           check_ftp
}
define service{
        use                     local-service
        host_name               mysql
        service_description     mysqlport
        check_command           check_tcp!3306
}
define servicegroup{  //设置服务的工作组
        servicegroup_name       servicegroup
        alias                   service-group
        members                 web,PING,web,SSH,web,SSHD,mysql,PING,mysql,SSH,mysql,ftp,mysql,mysqlport   //格式很重要的
}
  • 1
  • 2
  • 下一页
VMware Linux下Nagios的安装VMware Linux下Nagios和PNP的整合相关资讯      Nagios 
  • Linux下Nagios+PNP4Nagios的安装与  (今 08:25)
  • CentOS7安装Nagios并配置出图详解  (12/02/2015 19:36:58)
  • Nagios Core 4.1.0rc2 发布下载,  (07/18/2015 09:18:42)
  • Nagios 监控 SNMP 温度计  (08月21日)
  • CentOS 6.7 安装Nagios教程  (11/23/2015 10:36:49)
  • Nagios插件之登陆防火墙实现  (07/09/2015 19:58:25)
本文评论 查看全部评论 (0)
表情: 姓名: 字数