Initial setup load

49 views
Skip to first unread message

Gonzalo López

unread,
Oct 23, 2016, 8:28:44 PM10/23/16
to nagrestconf-users
Hi, I'm trying to do an initial setup via rest API. I added some things (timeperiods, contacts, contactgroups, hosttemplates, hosts and hostgroups).
I check the webapp and all the info is there, still not sure how it works but I guess it takes it from the .setup files.

Once I press Apply Changes it fails, the error is the following:

Creating hosts file local-nodes/empty-hostgroup/localhost.cfg
Creating hostgroups file local_hostgroups.cfg
ERROR: Entry for hostgroup, , is not defined in the
hostgroups file setup/local_hostgroups.setup. Aborting.



This is what I sent:
json=
{
"folder":"local",
"name":"linux-servers",
"alias":"Linux Servers",
"members":"localhost"
}

This is what I have in the local_hostgroups.setup file:
linux-servers,Linux Servers,,localhost,,,,

Any idea of what could be wrong? I don't know how to debug this.

Thank you

Mark Clarkson

unread,
Oct 24, 2016, 8:43:35 AM10/24/16
to nagrestconf-users
On Monday, 24 October 2016 01:28:44 UTC+1, Gonzalo López wrote:
Hi, I'm trying to do an initial setup via rest API. I added some things (timeperiods, contacts, contactgroups, hosttemplates, hosts and hostgroups).
I check the webapp and all the info is there, still not sure how it works but I guess it takes it from the .setup files.

The webapp uses REST api calls only. The REST API runs /usr/bin/nagctl, which modifies .setup files directly, or calls /usr/bin/csv2nag to [re]create nagios configuration files from the csv .setup files.
 

Once I press Apply Changes it fails, the error is the following:

Creating hosts file local-nodes/empty-hostgroup/localhost.cfg
Creating hostgroups file local_hostgroups.cfg
ERROR: Entry for hostgroup, , is not defined in the
hostgroups file setup/local_hostgroups.setup. Aborting.


This error is written by /usr/bin/csv2nag. Search for "Entry for hostgroup" in /usr/bin/csv2nag to see where the error was written. It's:

  echo "ERROR: Entry for hostgroup, $a, is not defined in the "

and $a is empty. I don't know why.
 


This is what I sent:
json=
{
"folder":"local",
"name":"linux-servers",
"alias":"Linux Servers",
"members":"localhost"
}

This is what I have in the local_hostgroups.setup file:
linux-servers,Linux Servers,,localhost,,,,


Looks good to me!
 

Any idea of what could be wrong? I don't know how to debug this.

I have not been able to replicate this problem.

Please try using the sample configuration then delete things you don't want.
Avoid using the members field for hostgroups. I'm not sure that the hostgroups auto file will be written for members, but it will when the hostgroup is mentioned in the host. I think I had to do this because having an empty hostgroup in nagios is an error(!), so to support members listed in the hostgroup will require some extra code.

If the problem doesn't show itself to you then please send me a tgz privately with everthing in your '/etc/nagios/objects/local/setup/' directory so I can replicate the problem and fix it.

Gonzalo López

unread,
Oct 26, 2016, 10:12:50 AM10/26/16
to nagrestconf-users
I'll try using the sample configuration and let you know. 

Another thing I noticed is that after the "Apply Configuration" fails an empty file "local_hostgroups.auto.setup" is created, maybe it's not connected but I mention it in case it is.
Reply all
Reply to author
Forward
0 new messages