Hostgroup hosts limit?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Hostgroup hosts limit?

Post by TSCAdmin »

Hi and happy New Year,

We are using Nagios XI 2009R1.3 on CentOS 5.4 (final) release. Today I tried to create a new host group for all the monitored Windows servers hosted at a data centre. There are 366 hosts in total. I created a new hostgroups.cfg file and placed it in /usr/local/nagios/etc/import directory. The hostgroups.cfg looked as follows:

Code: Select all

define hostgroup {
	hostgroup_name                		windows-servers-dc2
	alias                         		Windows Servers DC2
	members                       		member1,member2,.......,member366
	}
After this the hostgroups.cfg file was imported by going to CCM -> Tools -> Import Config Files -> selected the file and clicked "Import" button. The file was successfully imported and it displayed:

Code: Select all

Entry hostgroup_name::windows-servers-slough inside tbl_hostgroup successfully inserted
And finally I applied the configuration successfully.

Now, when I go to "Hostgroup Summary" it displays all the hostgroups including the new one but it shows only 285 servers leaving out last 81 hosts. I was wondering if I am missing something or there is a limit of characters or hosts while defining a new hostgroup?

Is there anything else I can provide to help investigate this issue further?

Thanks in advance.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Hostgroup hosts limit?

Post by lmiltchev »

I don't think there is a limitation on the number of characters. Do these 81 hosts actually exist? If you try to import some "fake" hosts that you intend to create later, only the ones that actually exist will get imported.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: Hostgroup hosts limit?

Post by benhank »

If I may piggy back on this, I too am having this issue. we had 514 objects in a hostgroup and 120 objects in another. Suddenly (I have verified no changes were made to the system), my count dropped to 89 and 40ish devices.
SWilkins helped me, but the issue returned. i even went so far as to delete the HG, and recreated in CCM and manually add the hosts. When I looked at the HG.cfg, it never added the hosts after the 89. After a lot of apply configs Nagios finally "took" the hosts.
Today I had to create a new HG and add hosts to the hg, Nagios kept 'dropping hosts" it took 3 to 4 tries before the numbers were correct. I was adding the hosts to the HG itself.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Hostgroup hosts limit?

Post by TSCAdmin »

Hi lmiltchev,

Yes, all these hosts actually exist and are being "monitored" by Nagios. All of them are currently in UP and OK state.

I have tried deleting and/or re-importing the hostgroups.cfg several times but it still shows me 285 hosts in this hostgroup. I tried adding the last few hosts by hand using the "Host Groups" configuration tool in CCM and it worked. However, it is not possible to do this by hand because there are many random hosts, new hosts are added each week and it's always error-prone. I'm not sure why the import tool is not taking them in properly.

Any thoughts?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Hostgroup hosts limit?

Post by mguthrie »

I'm pretty sure TSCAdmin and benhank are experiencing completely different issues.

TSCAdmin: You're running a MUCH older version of XI that probably still has a bug in it that chops off the config line after 1024 characters. Look for the following string in:
/var/www/html/nagiosql/functions/import_class.php

Code: Select all

$resFile = fopen($strFileName,"r",1024);
and change it to:

Code: Select all

$resFile = fopen($strFileName,"r");

benhank: Yours could be one of a few issues.

- Verify that you still have free space on your hard drive
- Check your apache log and make sure that PHP hasn't been timing out during the Apply Configuration process.
- Run the following commands:

Code: Select all

service nagios stop
service ndo2db stop
killall -9 nagios
killall -9 ndo2db
service ndo2db start
service nagios start
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

Re: Hostgroup hosts limit?

Post by benhank »

sorry did not want to have two issues in one post. I thought my issue was the same.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Hostgroup hosts limit?

Post by TSCAdmin »

Hi Mike,

I checked /var/www/html/nagiosql/functions/import_class.php but it already reads

Code: Select all

$resFile = fopen($strFileName,"r");
but there is one code entry, one line below, which read

Code: Select all

$strConfLine = fgets($resFile,4096);
so I changed it to:

Code: Select all

    $resFile = fopen($strFileName,"r");
    while(!feof($resFile)) {
      // $strConfLine = fgets($resFile,4096);
      $strConfLine = fgets($resFile,12288);
and it seems the problem has been solved. Is this method good?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Hostgroup hosts limit?

Post by mguthrie »

Yes, that's what it was. Sorry I missed the exact chunk of code, we fixed that bug well over a year ago. That was the issue and the fix though.


@benhank No worries. If the issue still persists go ahead and start up a new thread, we can dive in as needed.
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Hostgroup hosts limit?

Post by TSCAdmin »

Many thanks, Mike! I highly appreciate the quick turn around.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Hostgroup hosts limit?

Post by mguthrie »

You bet, glad it's working for you. :)
Locked