We’ve searched the documentation and the community site, and for the life of me, I cannot figure out if it is possible to “upload” a notification template and apply via the Icinga API.
Is something like this possible (not via Director)?
Thank you.
Version used (icinga2 --version) 2.13.7
Operating System and version: Ubuntu 20.04
Enabled features (icinga2 feature list): api checker icingadb mainlog notification
Icinga Web 2 version and modules (System - About): 2.11.4
Config validation (icinga2 daemon -C): will post if needed
I never tried via the API, but if you are looking for a way to do it using commands instead of any GUI, have you considered using the icingacli director … method? We were able to define all kinds of objects/templates with that. (Assuming with your “not via Director” you meant the eponymous GUI module.)
We do use the Director via its own API (not via the GUI), but we have an issue there because we cannot specify in a filter ZoneName (as in the ZoneName of the icinga daemon running on a master or a satellite).
This causes Notification objects to exist on master AND satellites and we want to notify only from satellites, not from masters, but the notifications trigger on both, so we have some workarounds, but it would be really nice if we didn’t have to.
See this “linked” topic which caused this question here
Alternatively you could build a simple file existence test near the beginning into your notification scripts (i.e. that do the mailing or texting or voice-messaging) a la “am I running on the master?” and if so, exit without doing anything. Then set up a “me master” static status file somewhere under /etc on the master node(s) only, that your scripts check existence for, and your script will effectively only run on the satellites…
I agree that option works, but we do not setup static configuration on the masters, we control all the configuration via Director or via Icinga API on the configuration master.
This is the reason I asked in the subject of this thread “via API”.
Yes, this is exactly our current workaround, but it would be nice to not have the notification objects being created also on masters.
Unfortunatelly I see nobody answered anything on the “sister ticket” of this one about the posibility to use ZoneName in the Director configuration without the Director forcing it to be a string.