Link to home
Start Free TrialLog in
Avatar of Harrison Aten
Harrison AtenFlag for United States of America

asked on

Delete bulk services using text file, then delete host using text file

I am very new to Rest API. Does anyone know how to create a script that will allow me to create an array of servers called host and delete all services attached to the host. In Nagios XI example cURL request to remove service is:

curl -XDELETE "https://nagiosservername/nagiosxi/api/v1/config/service?apikey=JNKelhL55D47u6GvniX7Y8oOlaQQ2V2LI3YjjZnoCKun6qVsLSS0gAOUJUK2P23N&pretty=1&host_name=testapihost&service_description=PING&applyconfig=1"

What I need to do is delete 700 servers from my Nagios XI install. In order to do that I need to first delete all that is configured for each host including all the services and host groups.
Avatar of leakim971
leakim971
Flag of Guadeloupe image

so you need to :
- get the list of servers
- get a list of services (general or using another REST call)
- create two foreach loop to remove using the REST call in your question

It's not clear what you've and what you don't
ASKER CERTIFIED SOLUTION
Avatar of Harrison Aten
Harrison Aten
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial