Page 1 of 1
Hostgroup hosts limit?
Posted: Mon Jan 07, 2013 7:35 am
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.
Re: Hostgroup hosts limit?
Posted: Mon Jan 07, 2013 11:01 am
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.
Re: Hostgroup hosts limit?
Posted: Mon Jan 07, 2013 1:21 pm
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.
Re: Hostgroup hosts limit?
Posted: Mon Jan 07, 2013 1:40 pm
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?
Re: Hostgroup hosts limit?
Posted: Mon Jan 07, 2013 5:14 pm
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
Re: Hostgroup hosts limit?
Posted: Mon Jan 07, 2013 5:22 pm
by benhank
sorry did not want to have two issues in one post. I thought my issue was the same.
Re: Hostgroup hosts limit?
Posted: Tue Jan 08, 2013 4:34 am
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?
Re: Hostgroup hosts limit?
Posted: Tue Jan 08, 2013 1:21 pm
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.
Re: Hostgroup hosts limit?
Posted: Wed Jan 09, 2013 9:25 am
by TSCAdmin
Many thanks, Mike! I highly appreciate the quick turn around.
Re: Hostgroup hosts limit?
Posted: Wed Jan 09, 2013 10:28 am
by mguthrie
You bet, glad it's working for you.
