Am 15.12.2015 um 11:52 schrieb Christian Moreno Moreno:
Hi,

we are testing the new API and I have some questions, maybe someone
can help me:

Question 1:
- If I created one host in /etc/icinga2/zones.d/zoneX/* and later I do
one update via API, then the file from /etc/icinga2/zones.d/zoneX/*
ist automatically updated with the file from
/var/lib/icinga2/api/packages/_api/*

Not sure if I may follow - care to elaborate by command and output in
detail?


- But, If I build one new host via API, then the file is not sync to
the /etc/icinga2/zones.d/ZoneX/* folder (and the file ist there missing)

The core process won't write anything underneath /etc/icinga2, it will
store its internal data below /var/lib/icinga2 and so on. Even the
config master validates the zone configuration from /etc/icinga2/zones.d
and will copy it into /var/lib/icinga2/api/zones for laster syncing to
relevant endpoints/zones.



Is possible in some way to have both folders/files updated? How should
we do for update manually one object that was created via API?

Manually updating object config files created by the API is *not*
supported, that's dangerous. Use the REST API for modifying your objects
by sending a POST request.


Question 2:

If I created one host via API with the Attribute zone (for example
Zone_A), then the host is created correctly for this Zone (for example
the satellite of this Zone do the checks), but the file ist created under:

/var/lib/icinga2/api/packages/_api/icinga-dev-01-1449060045-1/conf.d

and not under

/var/lib/icinga2/api/packages/_api/icinga-dev-01-1449060045-1/zones
.d/Zone_A

It does not matter. The "_api" package is used internally and you *must
not* fiddle with it manually, unless you know what you're doing (which
is obviously not the case, sorry).

Creating a file via the REST API will automatically sync all objects
from memory to all nodes. Even if you add a node later on, it will
ensure to sync all API created objects.

Try it.


This happens only if I create the host via API, if I create the host
via console under /etc/icinga2/zones.d/Zone_A, then the file ist sync
to
/var/lib/icinga2/api/packages/_api/icinga-dev-01-1449060045-1/zones.d/Zone_A/

You'll have multiple possibilities to add host/services belonging to a zone.

* Let the cluster config sync handle the static configuration files
underneath /etc/icinga2/zones.d
* use the API and add the "zone" Attribute inside the PUT request body
* Use config packages and their files "zones.d" (Note: There is a bug in
2.4.1 with that, fixed in git Master and probably backported to 2.4.2
once released)

Anything else is neither supported nor tested by us.

By default, you should not have to touch nor worry about anything
underneath /var/lib/icinga2.

Kind regards,
Michael


-- 
Michael Friedrich, DI (FH)
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | michael.friedr...@netways.de

** OSDC 2016 - April - netways.de/osdc **
** OSBConf 2016 - September - osbconf.org **
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to