Page 1 of 1

Logical question about Nagios structure

Posted: Tue Mar 29, 2016 1:20 am
by reincarne
Hi,
I'm wondering if I'm working incorrectly or this is the way Nagios XI was designed.
We are in a middle of adding all our current production environment to Nagios XI. We want to work as easy as possible of course. We designed some structure how do we want to see it in Nagios.

So we created hos groups and then we created groups of roles that contain a set of specific checks (in Excel), now we want to make it work in Nagios.
The problem is that there is no way to take a set of specific checks and assign it to a host group. Why do we need it? If in the future we will create a new whole environment in production and I will need to create a completely new host group with 100 host for example, I want to assign the host group to a specific role and it will get automatically all the needed checks.
Is there a way to do that or am I missing something here? Is there a way to work host based?

Re: Logical question about Nagios structure

Posted: Tue Mar 29, 2016 3:04 pm
by rkennedy
You should be able to use templates for this, which in turn will store values that you can then assign to hosts / services.

See this link for a more detailed explanation - https://assets.nagios.com/downloads/nag ... ricks.html

And, here's an example!

Host is defined as localhost -

Code: Select all

define host {
        use                             linux-server
        host_name                       localhost
        alias                           Localhost Alias Monitoring
        address                         localhost
        max_check_attempts              5
        check_period                    24x7
        notification_interval           30
        notification_period             24x7
}
Which is utilizing the template, linux-server[/icode -

Code: Select all

define host{
        name                            linux-server    ; The name of this host template
        use                             generic-host    ; This template inherits other values from the generic-host template
        check_period                    24x7            ; By default, Linux hosts are checked round the clock
        check_interval                  5               ; Actively check the host every 5 minutes
        retry_interval                  1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts              10              ; Check each Linux host 10 times (max)
        check_command                   check-host-alive ; Default command to check Linux hosts
        notification_period             workhours       ; Linux admins hate to be woken up, so we only notify during the day
                                                        ; Note that the notification_period variable is being overridden from
                                                        ; the value that is inherited from the generic-host template!
        notification_interval           120             ; Resend notifications every 2 hours
        notification_options            d,u,r           ; Only send notifications for specific host states
        contact_groups                  admins          ; Notifications get sent to the admins by default
        register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }
When inherited, the final result is -

Code: Select all

define host {
        host_name       localhost
        alias   Localhost Alias Monitoring
        address localhost
        check_period    24x7
        check_command   check-host-alive
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      5
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,d,u
        notifications_enabled   1
        notification_interval   30.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }
As you can see, localhost inherited from the linux-server template.

Is that what you were looking for?