Creating a new hostgroup by nagios server Or Creating a new hostgroup by nagios server


1. Open this path:


nano/usr/local/nagios/etc/objects/switch.cfg




# Define the switch that we'll be monitoring


define host {

    use                     generic-switch                      ; Inherit default values from a template

    host_name               CORE ; The name we're giving to this switch

    alias                   Linksys S5612 Switch             ; A longer name associated with the switch

    address                 100.100.100.2                  ; IP address of the switch

    hostgroups              switches                            ; Host groups this switch is associated with

    icon_image             router40.png

    statusmap_image         router40.gd2

}



### HOW TO ADD PARTENTS HOST ADD ###

define host {


    use                     generic-switch                      ; Inherit default values from a template

    host_name               Distribution                     ; The name we're giving to this switch

    alias                   Linksys S5612 Switch              ; A longer name associated with the switch

    address                 10.215.2.1                     ; IP address of the switch

    hostgroups              switches                            ; Host groups this switch is associated with

    icon_image             router40.png

    statusmap_image         router40.gd2

    parents      CORE

}






###############################################################################

#

# HOST GROUP DEFINITIONS

#

###############################################################################


# Create a new hostgroup for switches


define hostgroup {


    hostgroup_name          switches                            ; The name of the hostgroup

    alias                   Network Switches                    ; Long name of the group

}




###############################################################################

#

# SERVICE DEFINITIONS

#

###############################################################################


# Create a service to PING to switch

define service {


    use                     generic-service                     ; Inherit values from a template

    host_name               CORE                     ; 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

    check_interval          5                                   ; Check the service every 5 minutes under normal conditions

    retry_interval          1                                   ; Re-check the service every minute until its final/hard state is determined

}






2.Last Step: 

 systemctl restart nagios.service





Post a Comment

0 Comments