DevOps Class Classroom Series – 23/Jun/2021

Configuring Nagios

  • Nagios stores its configuration in a separate directory. Usually in /etc/nagios or /usr/local/nagios/etc
  • The main configuration file is called nagios.cfg.
  • The syntax in the main nagios configuration file
<parameter>=<value>
  • Configuration options: Refer Here for the official docs

  • The Nagios option resource_file defines a file to store the user variables. This file can be used to store additional information that can be accessed in all object definitions. These usually contain sensitive data as they can only be used in object definitions

Understanding macro definitions

Macro Description
HOSTNAME Short, unique name of the host; maps to host_name directive in the host object
HOSTADDRESS The IP or hostname of the hosts; maps to address directive in host object
HOSTDISPLAYNAME Description of host; Maps to the alias directive in host object
HOSTSTATE The current state of host
HOSTGROUPNAMES Short names of all host groups a host belongs to (Comma separated)
LASTHOSTCHECK The date and time of last check of the host (in UNIX timestamp)
LASTHOSTSTATE The last known state of host
SERVICEDESC Description of service
SERVICESTATE The current state of Service
CONTACTNAME unique name of contact
CONTACTALIAS Description of Contact
CONTACTEMAIL The email address of contact
CONTACTGROUPNAME Short names of all contact groups (comma separated)

Configuring hosts

  • Refer Here for the official documentation of host configuration
  • Sample
define host {
    host_name               node1
    alias                   Node 1 AWS
    address                 172.31.29.140
    check_command           check-host-alive
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    notification_period     24x7
    notification_interval   120
    notification_options    d,u,r
    contact_groups          admins

}
  • Things to know for Nagios configuration
    • Object Definitions
      • Host
      • Host Group
      • Services
      • Commands
      • Contact
      • Templates

Leave a Reply

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

About learningthoughtsadmin