Page 1 of 1

Custom template monitoring

Posted: Tue Aug 27, 2019 5:23 am
by titanexlol
Hello,

Im new to monitoring with nagios , so far i was able to install and monitor the host of the nagios , another server and a windows server with nrpe.

Problem is , the method i know is to create a custom cfg for each server , is it possible to have 1 cfg file to custom monitor all the servers?

I do not mean host group or service group , i what i mean is for example - servers.cfg

which will contain

define host{
host_name test-server
alias test-server
display_name test-server
address 10.0.0.1
check_commands check_ping,check_mem,check_load,check_ssh,check_disk,check_http
contacts [email protected]
contact_groups [email protected]
notification_interval 4
}

is this configuration possible? could you provide me with a method on how to make monitoring with nagios easier?

Thanks

Re: Custom template monitoring

Posted: Tue Aug 27, 2019 10:18 am
by scottwilkerson
This is not possible.

But once you define your hosts you can add multiple hosts to service definitions (either via hostgroups you comma separated in the host_name directive) and place them all in a single file

such as

Code: Select all

define service {
    host_name                test-server1,test-server2,test-server3
    service_description      Ping
    use                      generic-service
    check_command            check_ping
    register                 1
}

define service {
    host_name                test-server1,test-server2,test-server3
    service_description      Memory
    use                      generic-service
    check_command            check_mem
    register                 1
}

define service {
    host_name                test-server1,test-server2,test-server3
    service_description      Load
    use                      generic-service
    check_command            check_load
    register                 1
}

define service {
    host_name                test-server1,test-server2,test-server3
    service_description      DISK
    use                      generic-service
    check_command            check_disk
    register                 1
}