Page 1 of 1

JSON Query Generator

Posted: Thu Feb 22, 2018 11:53 am
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?

Re: JSON Query Generator

Posted: Thu Feb 22, 2018 12:07 pm
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.

Re: JSON Query Generator

Posted: Thu Feb 22, 2018 12:35 pm
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.

Re: JSON Query Generator

Posted: Thu Feb 22, 2018 1:11 pm
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.

Re: JSON Query Generator

Posted: Thu Feb 22, 2018 2:08 pm
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.

Re: JSON Query Generator

Posted: Fri Feb 23, 2018 1:06 pm
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.

Re: JSON Query Generator

Posted: Thu Mar 01, 2018 4:56 am
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.

Re: JSON Query Generator

Posted: Thu Mar 01, 2018 7:46 am
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

Re: JSON Query Generator

Posted: Mon Mar 12, 2018 10:50 pm
by sandeepatil
Thanks, for sharing info. Please close this thread.