Page 1 of 2
Is it possible to delete custom macros from the API?
Posted: Thu Nov 21, 2024 3:29 pm
by eloyd
Okay, back to APIs for a moment. Let's say I have a host called TESTAPIHOST and I use the API to PUT a config/host/.../_alice=foo custom variable onto the host. Works great. Next day, I decide that _foo was not the correct name and we want to use _bob instead.
There does not seem to be a way from the API to delete a config directive, either from hosts or services, without first deleting the entire host or service and recreating it.
I can change _alice=foo to _alice=bar with the API, and I can add _bob=foo with the API, but I can't remove _alice altogether.
Is this something we can hope will change in the future? Or did I miss something in my RTFMing?
Re: Is it possible to delete custom macros from the API?
Posted: Thu Nov 21, 2024 3:31 pm
by eloyd
@DoubleDoubleA do you care to chime in here?

Re: Is it possible to delete custom macros from the API?
Posted: Thu Nov 21, 2024 4:56 pm
by gwesterman
Hi @eloyd,
As far as I can see, you correct. There is no good way to just remove a custom variable via the API. Setting the variable to nothing e.g. "_testfree=" nearly works as it appears to be functionally removed from the host but the host still displays having a custom variable in the interface (despite there being none). I have made a feature request.
You can monitor the
changelog for any updates.
Thank you!
Re: Is it possible to delete custom macros from the API?
Posted: Thu Nov 21, 2024 5:03 pm
by eloyd
Thanks!
As long as we're feature-requesting API issues, can you add this to it:
I'd like to be able to either add an entity or modify an existing entity and mark it as "not active" similar to what you can do with the "Active" checkbox in the CCM. As far as I can tell, there is no way to do this with the API. We do a lot of API work with dynamic monitoring and being able to stage things as "in the database" but "inactive" would be a huge boon.
Re: Is it possible to delete custom macros from the API?
Posted: Thu Nov 21, 2024 7:05 pm
by DoubleDoubleA
Eric,
Your additional language has been added to the FR.
Thanks!
Aaron
Re: Is it possible to delete custom macros from the API?
Posted: Wed Feb 19, 2025 3:25 pm
by eloyd
Any hope for being able to mark hosts/services as "not active" in the API any time soon? That would be a real killer bonus for us when we do massive updates for customers.
Re: Is it possible to delete custom macros from the API?
Posted: Fri Feb 21, 2025 10:00 am
by DoubleDoubleA
@eloyd I will take a look at what is required on this.
Re: Is it possible to delete custom macros from the API?
Posted: Mon Feb 24, 2025 11:09 am
by DoubleDoubleA
@eloyd,
Can you get more specific on your "mark inactive" use case? Like, this is for an existing XI and you want to temporarily make hosts inactive? Or you set up a new server and you want to get all the hosts and services ready to rock but not monitor just yet? Or something else entirely?
When I look into how it is wired up, clearly no one imagined these use cases, though it makes a ton of sense. Even in the function that does a direct table import we don't support managing the "active" column.
Aaron
Re: Is it possible to delete custom macros from the API?
Posted: Mon Feb 24, 2025 11:14 am
by eloyd
PIck your poison for use case, but the two that come up most are similar to what you've described:
1. Staging large deployments where we want to put lots of things in play, but don't want them all happening all at once (mainly to avoid "what the hell are all these notifications" syndrome
2. Correcting mistakes made during previous deployments that we get hired to fix and need to have the ability to run things in parallel until we can turn off the old and go with the new, but still want to be able to easily switch back to the old.
Both of these would benefit greatly from the ability to check/uncheck the "Is Active" button from the API.
Re: Is it possible to delete custom macros from the API?
Posted: Tue Feb 25, 2025 10:24 am
by DoubleDoubleA
The heart of the challenge is that "active" is not a Core config, it's a column in the table(s), and the API calls get routed through the importFile functionality of the CCM instead of doing a direct table modification, so it doesn't appear to be an easy-peasy add to the existing call, which would be the ideal state.
In the Core Object Definitions we do have "active_checks_enabled" and "passive_checks_enabled" for both hosts and services, and both of those currently have API support. Any chance you could leverage these?