Page 1 of 2

Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 3:02 am
by michaelpn
Hi,
I would like to add more Host Groups on my Nagios Site. Right now I have one for Citrix Servers and would like to have one for Web Servers too. How it is possible to do that ? Right now as written I have crated a Config file for Citrix Servers "hostgroubs.cfg" then I would like to have one for my Web Servers. Why ? because then I have a better view on the Nagios interface.

michaelpn :)

Re: Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 7:22 am
by tacolover101
yes - just create a definition in any of your config files. (based on what config file or dirs you are picking up in your nagios.cfg)

https://assets.nagios.com/downloads/nag ... #hostgroup

Re: Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 11:42 am
by dwhitfield
Thanks @tacolover101!

You can put all of the hostgroups in the same config file, or you can separate them out. Since you already have a hostgroups.cfg (I'm assuming that's correct), I would just go with that.

Are all of your web servers already set up as hosts? If not, you'll need to do that too.

Re: Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 1:43 pm
by DiegoAnjos
Personally I prefer to have a file per host, so I define the hostgroup in each host file, as below:

Code: Select all

define host{
	use			windows-server
	host_name	SRVXXX
	alias			SRVXXX
	address			192.X.X.X
	icon_image_alt		Intranet Server
	icon_image		www_server.png
	statusmap_image	www_server.gd2
	hostgroups		G03
	parents			SW-XXXXXX
	}
On hostgroups.cfg I define the group:

Code: Select all

define hostgroup{
        hostgroup_name  	G03
        alias           	        WEB SERVERS
        }

TIP: I name my groups as G1, G2, G3, N1 and so on so Nagios Web Interface will sort them alphabetically.
The ALIAS I set with a friendly name to help myself and others to quickly find hosts/hostgroups.

Re: Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 1:48 pm
by dwhitfield
Thanks @DiegoAnjos! That's exactly what we do in XI by default. I'd quibble with saying you define the hostgroup in the host file. You are setting or associating the hostgroup in the host file. The definition is in hostgroups.cfg per your example. I know what you mean, but I'm just clarifying for people new to nagios.

Re: Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 2:54 pm
by DiegoAnjos
@dwhitfield

Sorry, I am not a native english speaker. Thanks for making my statement more understandable :D

Re: Add more Host Groups Nagios

Posted: Wed Sep 06, 2017 3:00 pm
by dwhitfield
@DiegoAnjos, no problem!

FWIW, I think it's a fine English use of the word define, it's just that define has a very specific meaning in nagios config files. :)

OP, did you have any other questions?

Re: Add more Host Groups Nagios

Posted: Mon Sep 11, 2017 3:42 am
by michaelpn
Hi,

many thanks for your answers. That is exactly what I have done. But if you look at my attachments you will see I only use "houstgroups.cfg" for my citrix- and web servers and nagiso shows that on the interface but what is nagging me is that Nagios shows me WSTEST1 on both host one for citrix-servers and web-servers. Why ?

Re: Add more Host Groups Nagios

Posted: Mon Sep 11, 2017 9:12 am
by scottwilkerson
Can you show the config for WSTEST1 and any templates that are applied?

Re: Add more Host Groups Nagios

Posted: Wed Sep 13, 2017 6:44 am
by michaelpn
Hi,
please :)