Nagios/Schematics

From Segfault
Jump to: navigation, search

Schema

A very basic schematic of some Nagios configuration files.

 nagios.cfg          
 |                            
 |- log_file=/var/log/nagios3/nagios.log
 |-  cfg_dir=/etc/nagios-plugins/config  ------- ping.cfg, Example:
 |-  cfg_dir=/etc/nagios3/conf.d                 |
              |                                  |- define command {
              |                                      command_name  check_ping
              |                                      command_line  /usr/lib/nagios/plugins/check_ping \
              |                                               -H '$HOSTADDRESS$' -w '$ARG1$' -c '$ARG2$' }
              |
              |
              |-commands.cfg    --- User defined commands
              |-contacts.cfg    --- Contacts
              |-timeperiods.cfg --- Time periods
              |
              |-generic-host.cfg    --- Generic host definitions
              |-generic-service.cfg --- Generic service definitions
              |
              |-hostgroups.cfg
              |              |- define hostgroup { hostgroup_name cisco   }
              |              |- define hostgroup { hostgroup_name juniper }
              |              |- define hostgroup { hostgroup_name routers, hostgroup_members cisco, juniper }
              |
              |-hosts.cfg
              |         |- define host { use generic-host, host_name asa01, address 10.0.0.1, hostgroups cisco }
                        |- define host { use generic-host, host_name pix03, address 10.0.0.2, hostgroups cisco }
              |
              |-servicegroups.cfg
              |              |- define servicegroup { servicegroup_name www }
              |              |- define servicegroup { servicegroup_name ssh }                
              |              |- define servicegroup { servicegroup_name network, servicegroup_members www, ssh }
              |
              |
              |-services.cfg
              |            |- define service { use generic-service
              |            |                   check_command         check_ping!200.0,20%!500.0,60%
              |            |                   service_description   ping
              |            |                   servicegroups         network
              |            |                   hostgroup_name        routers
              |            |                  }
              |            |
              |            |- define service { use generic-service
              |            |                   check_command         check_ssh
              |            |                   service_description   ssh
              |            |                   servicegroups         ssh
              |            |                   hostgroup_name        cisco
              |            |                  }

Relationships

                                               contacts.cfg
                                                  |
                                                  |- define contact { 
                                                        contact_name   admin           x----------------|
                                                        email          root@localhost                   |
                                                     }                                                  |
                                                                                                        |
                                                timeperiods.cfg                                         |
                                                  |                                                     |
                                                  |- define timeperiod {                                |
                                                        timeperiod_name 24x7             *----------|   |
                                                        monday          00:00-24:00                 |   |
                                                        [...]                                       |   |
                                                     }                                              |   |
                                                                                                    |   |
                                                                                                    |   |
   hosts.cfg                                     generic-host.cfg                                   |   |
      |                                                       |                                     |   |
      |- define host {                                        |- define host {                      |   |
      |    use             generic-host     ----------------->     name                generic-host |   | 
      |    host_name       one.example.org              |          contacts            admin   x--------|
      |    alias           one                          |          notification_period 24x7    *----|
      |    address         10.0.0.1                     |          register            0
|--------+ hostgroups      routers                      |        }
|     |  }                                              |
|     |                                                 |
|     |                                                 |
|     |- define host {                                  |
|          use             generic-host     ------------|  
|          host_name       two.example.org
|          alias           two
|          address         10.0.0.2
|--------o hostgroups      webservers
|        } 
|    
|   
|   
|   services.cfg                                     generic-service.cfg
|      |                                                       |
|      |- define service {                                     |- define service {
|      |    use                  generic-service ------------->     name                generic-service
|      |    check_command        check_ping              |          contacts            admin
|      |    service_description  ping                    |          notification_period 24x7
|      |    hostgroup_name       routers                 |          register            0
|      |  }                                              |        }
|      |                                                 |
|      |- define service {                               |
|           use                  generic-service  -------|
|           check_command        check_http
|           service_description  http
|           host_name            two.example.org
|         }
|
|
|   hostgroups.cfg
|      |
|      |- define hostgroup {
|---------+ hostgroup_name       routers
|      |    alias                All routers
|      |  }
|      |
|      |- define hostgroup {
|---------o hostgroup_name       webservers
            alias                All webservers
          }

Links