Monitoring the Group of Servers

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Monitoring the Group of Servers

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitoring the Group of Servers

Post 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
Former Nagios employee
https://www.mcapra.com/
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: Monitoring the Group of Servers

Post by amitgupta19 »

@mcpra Thanks for the detailed steps.

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

Re: Monitoring the Group of Servers

Post by kyang »

Thanks @mcapra!

@amitgupta19, Let us know how it goes or if this answered your question once you've tried it!
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: Monitoring the Group of Servers

Post by amitgupta19 »

Sure i will update, once i try this solution.
dwasswa

Re: Monitoring the Group of Servers

Post by dwasswa »

Please try that and let us know how it goes.
Locked