Page 1 of 1

Create and Rotate users in Contactgroup programatically.

Posted: Fri May 05, 2023 10:55 am
by Sargento
All,

We want to create a contact group through the Nagios REST API but I've been struggling to find a doc about this task online. I need your help here. The below text is what I have so far (not working).

curl -XGET "http://(IP)/nagiosxi/api/v1/system/status?apikey=(API KEY)&pretty=1" -d "contactgroup_name=(API-CONTACT-GROUP)&alias=(API-CONTACT-GROUP)&members=(MEMBERNAME)"

Basically we want to create a group through the API and then have the group members change once a week or so. So the programming side of changing the user isn't the problem here it's figuring out the curl command to actually create the group or change the user of an existing group.

Any help would be great. There was a post on here from 2017 that says this functionality didn't exist yet but it was coming soon so I'm hoping that this is possible.

Thanks

Re: Create and Rotate users in Contactgroup programatically.

Posted: Fri May 05, 2023 11:38 am
by Sargento
Here is the answer I was looking for.

curl -XPUT "http://(ip)/nagiosxi/api/v1/config/contactgroup/(contactgroupname)?apikey=(apikey)&pretty=1&members=(membername)&applyconfig=1"