Learning Academy

The Cure of Ignorance is to Question. MUHAMMAD (PBUH)

Monitoring

How to install Nagios on CentOS?

Host and host groups CFG

[root@yourmachine  nagios] vim hosts.cfg

# Generic host definitions
define host{
name                                          generic-host    ; Generic template name
notifications_enabled               1               ; Host notifications are enabled
event_handler_enabled           1               ; Host event handler is enabled
flap_detection_enabled            1               ; Flap detection is enabled
process_perf_data                    1               ; Process performance data
retain_status_information                   1               ; Retain status information across program restarts
retain_nonstatus_information            1               ; Retain non-status information across program restarts
register                                       0               ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!
}

# This creates a generic template that any host can use.
# Notifies never, checks 15 times before showing critical on CGI interface,

define host{
name                    basic-host
use                     generic-host
check_command           check-host-alive
max_check_attempts      15
notification_interval   0
notification_period     none
notification_options    n
register                0
}

# This creates a generic host that your routers can use
# monitors host(s) 24×7, notifies on down and recovery, checks 15 times before going critical,
# notifies the contact_group every 30 minutes

define host{
name                    your-routers-host
use                     generic-host
check_command           check-host-alive
max_check_attempts      15
notification_interval   30
notification_period     24×7
notification_options    d,r
register                0
}

define host{
use                     basic-host
host_name               mymachine1
alias                   mymachine1
address                 192.168.100.101
contact_groups          einsteins
#       notification_options    d,r  #overrides the basic-host option
}

define host{
use                     your-routers-host
host_name               router1
alias                   router1
address                 192.168.100.100
contact_groups          einsteins
}

Muhammad Shaukat

Content Developer at LearnAcad.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest