Page 1 of 1

Monitoring the Group of Servers

Posted: Tue Oct 24, 2017 5:59 am
by amitgupta19
I Want to do the same type of monitoring on 50 servers.

Please let me know how to apply the same type of on a group of servers.

Re: Monitoring the Group of Servers

Posted: Tue Oct 24, 2017 8:56 am
by mcapra
So I have a group of 4 machines all supporting an ElasticSearch cluster. Naturally, I would like to monitor all of them in roughly the same way without configuring each one individually.

I do this by first defining individual host objects:

Code: Select all

define host{
        use                     linux-server
        host_name               esprod00
        address                 esprod00
		  check_command           check_elasticsearch!checkapi!!
}


define host{
        use                     linux-server
        host_name               esprod01
        address                 esprod01
		  check_command           check_elasticsearch!checkapi!!
}


define host{
        use                     linux-server
        host_name               esprod02
        address                 esprod02
		  check_command           check_elasticsearch!checkapi!!
}


define host{
        use                     linux-server
        host_name               esprod03
        address                 esprod03
		  check_command           check_elasticsearch!checkapi!!
}
Where esprod00-03 represents the 4 machines I'd like to monitor in roughly the same way. Once I have those basic host objects defined, I can group all of those hosts together in a hostgroup like so:

Code: Select all

define hostgroup{
        hostgroup_name          esprod
        members                 esprod00,esprod01,esprod02,esprod03
}
Now that all the hosts are grouped together into a single hostgroup named esprod, I can easily assign services to each host in that hostgroup by assigning the services at the hostgroup level:

Code: Select all

define service{
        use                             elasticsearch-prod         
        hostgroup_name                  esprod
        service_description             CPU Usage
        check_command                   check_elasticsearch!checkcpu!-w 80 -c 90
}

define service{
        use                             elasticsearch-prod         
        hostgroup_name                  esprod
        service_description             Memory Usage
        check_command                   check_elasticsearch!checkmem!-w 80 -c 90
}

define service{
        use                             elasticsearch-prod         
        hostgroup_name                  esprod
        service_description             Heap Usage
        check_command                   check_elasticsearch!checkheap!-w 90 -c 98
}

define service{
        use                             elasticsearch-prod         
        hostgroup_name                  esprod
        service_description             Cluster Status
        check_command                   check_elasticsearch!checkclusterstatus!
}

define service{
        use                             elasticsearch-prod         
        hostgroup_name                  esprod
        service_description             Ping
        check_command                   check_ping!500.0,30%!1000.0,60%
}
By leveraging the hostgroup_name directive in my service definitions, I can apply many services to many hosts under a single hostgroup. This saves an awful lot of time when dealing with hundreds of servers that all have roughly the same monitoring requirements.

More on hostgroups:
https://assets.nagios.com/downloads/nag ... #hostgroup

Re: Monitoring the Group of Servers

Posted: Tue Oct 24, 2017 10:08 am
by amitgupta19
@mcpra Thanks for the detailed steps.

It should be helpful. I will implement it and if anything comes will let you know.

Re: Monitoring the Group of Servers

Posted: Tue Oct 24, 2017 10:48 am
by kyang
Thanks @mcapra!

@amitgupta19, Let us know how it goes or if this answered your question once you've tried it!

Re: Monitoring the Group of Servers

Posted: Tue Oct 24, 2017 11:04 am
by amitgupta19
Sure i will update, once i try this solution.

Re: Monitoring the Group of Servers

Posted: Tue Oct 24, 2017 1:44 pm
by dwasswa
Please try that and let us know how it goes.