5.配置Nagios www.iyunv.com
a.编辑/usr/local/nagios/etc/nagios.cfg
将#cfg_file=/usr/local/nagios/etc/objects/switch.cfg前面的#去掉
b.编辑/usr/local/nagios/etc/object/switch.cfg文件
设定监控主机的相关内容
define host{
use generic-switch ; Inherit default values from a template
host_name Gateway ; The name we're giving to this switch
alias Firewall ; A longer name associated with the switch
address 192.168.200.1 ; IP address of the switch
hostgroups allhosts,switches ; Host groups this switch is associated with
}监控包的丢失率和RTA响应时间
define service{
use generic-service ; Inherit values from a template
host_name Gateway ; The name of the host the service is associated with
service_description PING; The service description
check_command check_ping!200.0,20%!600.0,60% ; 在超过200ms或丢包率在20%上的启动警告,超过600ms或丢包达到60%的启动报警
normal_check_interval 5; 在正常情况下,每五分钟监控一次
retry_check_interval 1; 在异常情况下,每分钟监控一次
}
利用SNMP监控交换和网关设备define service{
use generic-service ; Inherit values from a template
host_name Gateway
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
} www.iyunv.com
利用MRTG来监控网络流量信息
define service{
use generic-service ; Inherit values from a template
host_name Gateway
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.200.1_1.log!AVG!1000000,2000000!5000000,5000000!10
}利用command里面设定的check_local_mrtgtraf获取本地保存的mrtg流量日志信息来监控,获取文件是/var/lib/mrtg/192.168.200.1_1.log获取数据值是采取AVG的值,数值在1M~2M之间,则状态改为warning,如果超过5M的话则状态改为critical 完成配置后service nagios restart