JSON Query Generator

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
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

JSON Query Generator

Post by sandeepatil »

Question about JSON Query Generator :

Can you use JSON Query Generator API writable as in Nagios XI?
Can we use JSON Query Generator to delete objects?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: JSON Query Generator

Post by mcapra »

sandeepatil wrote:Can you use JSON Query Generator API writable as in Nagios XI?
Yes, the JSON CGIs work just as well in Nagios Core as they do in Nagios XI. This is assuming your Nagios Core version includes the JSON CGIs, which it should if you're using a recent version.

No, you can't "write" anything with the JSON CGIs. That's exclusively a Nagios XI REST API thing.
sandeepatil wrote:Can we use JSON Query Generator to delete objects?
Nope. The JSON CGIs are exclusively for "reading" Nagios Core data.
Former Nagios employee
https://www.mcapra.com/
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: JSON Query Generator

Post by sandeepatil »

Thanks for sharing details.

You know other way to delete host, like XI API. (curl -XDELETE).

If have any reference customization detail nagios core / file level to get done expected output, please share.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: JSON Query Generator

Post by mcapra »

There's a bunch of external commands you can leverage to programatically take actions in Nagios Core:
https://old.nagios.org/developerinfo/ex ... ndlist.php

But those don't have anything to do with configuration management.

You'd need to first install some sort of configuration management utility on top of Nagios Core to even begin to get that sort of functionality. There's nothing native to Nagios Core that allows you to manage configuration files. Nagios Core just reads a configuration file and loads the object into it's configuration set.

There's a few open source configuration management utilities out there. To name a few:
https://sourceforge.net/projects/nagiosql/
https://twiki.cern.ch/twiki/bin/view/LCG/NagConf
https://sourceforge.net/projects/lilac--reloaded/

I don't know if any of them provide the same sort of functionality offered by the Nagios XI REST API.

This is also the sort of problem you could solve with system configuration management and automation utilities like Ansible, Chef, Puppet, Salt, etc.
Former Nagios employee
https://www.mcapra.com/
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: JSON Query Generator

Post by sandeepatil »

Will check with shared details.

I know GET function of JSON Query Generator, can you share example POST and HEAD. I tried but not succeeded.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: JSON Query Generator

Post by scottwilkerson »

One thing I will add is while there are commands as pointed out to delete hosts/services, this does NOT delete them from your configuration files and hence that will still have to happen.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: JSON Query Generator

Post by sandeepatil »

Using nrdp, we can shutdown the nagios server using external command.

Please find attached file.

http://<server_name>/nrdp.

Want to know, with same way can we delete the service from Nagios config file.
Attachments
NRDP external command trigger
NRDP external command trigger
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: JSON Query Generator

Post by scottwilkerson »

sandeepatil wrote:Want to know, with same way can we delete the service from Nagios config file.
This is not possible in Nagios Core, only Nagios XI
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
sandeepatil
Posts: 211
Joined: Tue Dec 27, 2016 3:12 am

Re: JSON Query Generator

Post by sandeepatil »

Thanks, for sharing info. Please close this thread.
Locked