配置交换机被监控机(客户端)
本文讲述的是:Redhat配置nagios。返回大纲。
这里的switch.cfg是交换机的一个监控模板,我保留这个cfg,复制为switch31.cfg编辑
- [root@localhost objects]# vi /usr/local/nagios/etc/nagios.cfg
- # Definitions for monitoring a router/switch
- #cfg_file=/usr/local/nagios/etc/objects/switch.cfg
- cfg_file=/usr/local/nagios/etc/objects/switch31.cfg
几乎不用改,把host name和address改了,最后一个mrtg我没用网络里没有注释掉了
- [root@localhost objects]# vi switch31.cfg
- define host{
- use generic-switch ; Inherit default values from a template
- host_name g13a-dell5424-31 ; The name we're giving to this switch
- alias Linksys SRW224P Switch ; A longer name associated with the switch
- address 10.155.0.31 ; IP address of the switch
- hostgroups switches ; Host groups this switch is associated with
- }
- define hostgroup{
- hostgroup_name switches ; The name of the hostgroup
- alias Network Switches ; Long name of the group
- }
- define service{
- use generic-service ; Inherit values from a template
- host_name g13a-dell5424-31 ; 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% ; The command used to monitor the service
- normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
- retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
- }
- # Monitor uptime via SNMP
- define service{
- use generic-service ; Inherit values from a template
- host_name g13a-dell5424-31
- service_description Uptime
- check_command check_snmp!-C chrswitch -o sysUpTime.0
- }
- # Monitor Port 1 status via SNMP
- define service{
- use generic-service ; Inherit values from a template
- host_name g13a-dell5424-31
- service_description Port 1 Link Status
- check_command check_snmp!-C chrswitch -o ifOperStatus.1 -r 1 -m RFC1213-MIB
- }
- # Monitor bandwidth via MRTG logs
- #define service{
- # use generic-service ; Inherit values from a template
- # host_name linksys-srw224p
- # service_description Port 1 Bandwidth Usage
- # check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.1.253_1.log!AVG!1000000,1000000!5000000,5000000!10
- # }
Switch就完成,红色见问题3(图4)
【编辑推荐】