Programmatically deleting service from Core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Programmatically deleting service from Core

Post by grenley »

Hi.

Is there any way, an API call perhaps, to programmatically delete a service from Core?
We have 90k+ servers (on a bunch of Core servers) and going through the GUI or editing a file as services are deleted is not going to be manageable.

Thanks,
Rick
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Programmatically deleting service from Core

Post by scottwilkerson »

There isn't a way builtin to do this in Core, however this can be accomplished with the API in Nagios XI
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
grenley
Posts: 96
Joined: Tue May 13, 2014 6:06 pm

Re: Programmatically deleting service from Core

Post by grenley »

Fair enough.
If there isn't a built-in way to do it, do you have any suggestions how we can build it (without XI)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Programmatically deleting service from Core

Post by tmcdonald »

Depends on how long-term of a solution you need.

If you just want a one-off way to delete a lot of specific config files, then proper use of bash or some other programming language should do the trick. grep for a list of host or service names, grab the file name, rm or mv to take it out of the running config, then restart Core.

If you need something reusable, you will want to use a similar workflow, but also expose it on a port to make it an API. That would obviously take more work, but it would be something you could hook into other systems more easily.
Former Nagios employee
Locked