Is it possible to delete custom macros from the API?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Is it possible to delete custom macros from the API?

Post by eloyd »

We leverage active_checks_enabled today, but it still leaves things in a state that the checks are "active" just not being checked. Can make for confusing reports when we want to have "old disk check" and "new disk check" (for instance).

Was hoping that this could be an easy fix, but we'll continue to do the unsupported thing that we do today of mucking directly with the database.

Shhh!! Don't tell our customers that we do unsupported things!
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
DoubleDoubleA
Posts: 286
Joined: Thu Feb 09, 2017 5:07 pm

Re: Is it possible to delete custom macros from the API?

Post by DoubleDoubleA »

Turns out it is already implemented but not documented. Use the "register" key with a value of either 0 or 1 to set whether a host or service is active or not.

Code: Select all

register=0
register=1
curl -XPUT "http://192.168.94.133/nagiosxi/api/v1/config/service/192.168.0.32/Uptime?apikey=Qug46nWv9BrV3D82f&pretty=1&register=0&applyconfig=1"
0 for "not active" 1 for "active". Standard Core rules still apply, a host's services need to be made not active before the host can be made inactive.

I was in the middle of rubber ducking to a dev here why it wasn't going to be simple when we came across where it is actually implemented. The good news is I have now read the entire api code from Apache configs to ccm scripts. I'll take a look at getting this into the documentation.

On the issue this thread started with, not being able to delete a custom variable via the api seems to be a side effect of being able to modify a single config without passing the entire config. It looks like the only way to be rid of it is to delete and entirely re-do the config. But maybe if I re-read the api code with this question in mind, I'll find a different answer.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Is it possible to delete custom macros from the API?

Post by eloyd »

I'm looking for the "mind blown" emoji.... :o

Thanks!!!!! We'll have to see if we can break it!!


Happy to find out about the deleting custom variables, but it's more of a "we want things to look clean by not setting them to null values" than anything important. You've just made my day with the rest of this.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Post Reply