Add more Host Groups Nagios

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.
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Add more Host Groups Nagios

Post 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 :)
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Add more Host Groups Nagios

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Add more Host Groups Nagios

Post 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.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Add more Host Groups Nagios

Post 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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Add more Host Groups Nagios

Post 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.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Add more Host Groups Nagios

Post by DiegoAnjos »

@dwhitfield

Sorry, I am not a native english speaker. Thanks for making my statement more understandable :D
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Add more Host Groups Nagios

Post 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?
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Re: Add more Host Groups Nagios

Post 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 ?
Attachments
hostgroups nagios.JPG
hostgroup definition.JPG
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Add more Host Groups Nagios

Post by scottwilkerson »

Can you show the config for WSTEST1 and any templates that are applied?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Re: Add more Host Groups Nagios

Post by michaelpn »

Hi,
please :)
Attachments
windows.cfg
(7.27 KiB) Downloaded 473 times
templates.cfg
(10.35 KiB) Downloaded 304 times
hostgroups.cfg
(9.85 KiB) Downloaded 284 times
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
Locked