NagiosXI API - GET objects/host is_active parameter

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
wbaars
Posts: 9
Joined: Tue Jul 05, 2016 6:05 am

NagiosXI API - GET objects/host is_active parameter

Post by wbaars »

I think I have found an issue in the NagiosXI API:

When I try to build a limited query, to filter on "is_active", the only working value is "1".
If I enter an other value, such as "0" or "ne:1" I get 0 records back, and there are inactive hosts.
Also when requesting an existing INACTIVE host, the API returns 0 records.

Is this expected behaviour?

Powershell example

Code: Select all

PS S:\> Invoke-RestMethod "https://our.nagios.server/nagiosxi/api/v1/objects/host?apikey=1232314&is_active=ne:1"

recordcount
-----------
0


PS S:\> Invoke-RestMethod "https://our.nagios.server/nagiosxi/api/v1/objects/host?apikey=1232314&is_active=1"

recordcount host
----------- ----
7424         {@{@attributes=; instance_id=1; host_name=win-hostname-example; is_active=1; config_type=1; al...

scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NagiosXI API - GET objects/host is_active parameter

Post by scottwilkerson »

Being is_active is just a binary 0 or 1, you should be able to accomplish either of these with

Code: Select all

https://our.nagios.server/nagiosxi/api/v1/objects/host?apikey=1232314&is_active=1
or

Code: Select all

https://our.nagios.server/nagiosxi/api/v1/objects/host?apikey=1232314&is_active=0
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NagiosXI API - GET objects/host is_active parameter

Post by scottwilkerson »

I'm going to retract that......

The is_active field is always 1 because the API will only ever show active items in objects/host
(quite frankly I don't know why we are returning it)
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
wbaars
Posts: 9
Joined: Tue Jul 05, 2016 6:05 am

Re: NagiosXI API - GET objects/host is_active parameter

Post by wbaars »

Thanks for the reply.
Too bad the API only lists active items. It would be nice to also get the inactive items.

I am trying to see if a host already exists in Nagios, and is active or inactive.
If so, when creating a new host via the API it would be nice know if there already is a host with the same name or address (or other field).
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NagiosXI API - GET objects/host is_active parameter

Post by scottwilkerson »

I'll put in a feature request to get it added to the config/host and config/service api
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
wbaars
Posts: 9
Joined: Tue Jul 05, 2016 6:05 am

Re: NagiosXI API - GET objects/host is_active parameter

Post by wbaars »

Thanks. I hope this feature will be added in future release of NagiosXI.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NagiosXI API - GET objects/host is_active parameter

Post by scottwilkerson »

wbaars wrote:Thanks. I hope this feature will be added in future release of NagiosXI.
Yep.

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked