JSON Query Generator

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

JSON Query Generator

Postby sandeepatil » Thu Feb 22, 2018 11:53 am

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

Re: JSON Query Generator

Postby mcapra » Thu Feb 22, 2018 12:07 pm

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
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3398
Joined: Thu May 05, 2016 3:54 pm

Re: JSON Query Generator

Postby sandeepatil » Thu Feb 22, 2018 12:35 pm

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

Re: JSON Query Generator

Postby mcapra » Thu Feb 22, 2018 1:11 pm

There's a bunch of external commands you can leverage to programatically take actions in Nagios Core:
https://old.nagios.org/developerinfo/externalcommands/commandlist.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
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3398
Joined: Thu May 05, 2016 3:54 pm

Re: JSON Query Generator

Postby sandeepatil » Thu Feb 22, 2018 2:08 pm

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

Re: JSON Query Generator

Postby scottwilkerson » Fri Feb 23, 2018 1:06 pm

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 11693
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: JSON Query Generator

Postby sandeepatil » Thu Mar 01, 2018 4:56 am

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.PNG
NRDP external command trigger
sandeepatil
 
Posts: 129
Joined: Tue Dec 27, 2016 3:12 am

Re: JSON Query Generator

Postby scottwilkerson » Thu Mar 01, 2018 7:46 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 11693
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: JSON Query Generator

Postby sandeepatil » Mon Mar 12, 2018 10:50 pm

Thanks, for sharing info. Please close this thread.
sandeepatil
 
Posts: 129
Joined: Tue Dec 27, 2016 3:12 am


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 9 guests