Hello,
We have configured a Distributed monitoring using Icinga and have the following Roles:
1 x Master
4 x Satellite
40 x Agents
Some of our Agents don’t have access to the Master directly.
We have a script which automatically registers host on the Master using Director API:
# Add Host
curl -k -u "$director_user:$director_pass" \
-H 'Accept: application/json' \
-X PUT "$director_url/host" \
-d "{\"object_name\": \"$ipaddress\", \"object_type\": \"object\", \"address\": \"$ipaddress\", \"display_name\": \"$display_name\", \"imports\": \"$host_template\"}"
# Deploy config
curl -k -u "$director_user:$director_pass" \
-H 'Accept: application/json'\
-X POST "$director_url/config/deploy"
With Director API all working as expected.
For the hosts where Master is not accessible, we are trying to do it via calling Satellite API:
curl -k -u "$sattelite_user:$sattelite_pass" \
-H 'Accept: application/json' \
-X PUT "$satellite_url/v1/objects/hosts/$ipaddress" \
-d "{ \"templates\": [ \"$host_template\" ], \"attrs\": { \"address\": \"$ipaddress\"} }"
It is like an example from documentation. With Satellite API we got an error:
{“results”:[{“code”:500.0,“errors”:["Error: Validation failed for object ‘192.168.1.10!Disk’ of type ‘Service’; Attribute ‘command_endpoint’: Object ‘192.168.1.10’ of type ‘Endpoint’ does not exist.\nLocation: in /var/lib/icinga2/api/zones/director-global/director/service_templates.conf
…
…
Found something similar on the forum: Chicken and egg issue: 'Endpoint' does not exist.
@dnsmichi, can you please point to the exact issue on GitHub?
And some general questions appear here:
- Is there a way to add host using the Satellite?
- How config changes can be deployed via Satellite as we do it using Director?
- If it can’t be done via Satellite - how can it be done in such a Distributed setup, using API calls?
Thank you!