Using Nagios API updating(XPUT) hostgroup is failing

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Using Nagios API updating(XPUT) hostgroup is failing

Post by lmiltchev »

So, with limited user permission GET command also won't execute?
Unfortunately no - I already tried, then talked to our developers. "Regular" users won't be able to access this endpoint.
Be sure to check out our Knowledgebase for helpful articles and solutions!
bseuser
Posts: 39
Joined: Thu Jul 02, 2020 2:33 am

Re: Using Nagios API updating(XPUT) hostgroup is failing

Post by bseuser »

Hi,

Is there any feature enhancement to allow the users to use API to change/modify/delete the hosts and services owned by users( Teams/Groups ) instead of admin to use API?

Our use case here is that we need to give multiple teams access to their self-service to their owned systems. We feel that API is a good way to provide access, but I see API has very little functionality.

I tried with Multy-Tenancy way with Limited access to CCM, and the users can modify the host and services but not create the services.

Thanks,
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Using Nagios API updating(XPUT) hostgroup is failing

Post by ssax »

I have created the request:

Code: Select all

FR: XI - API - Add config endpoint access to regular users to allow them to configure the things they are allowed to - Allow them to access the system/scheduleddowntime one as well
Please keep in mind that the decision to implement the enhancement is at the discretion of our development team.

Currently non-admin users can only access the objects API endpoint, the config/system ones are reserved for admins.
I tried with Multy-Tenancy way with Limited access to CCM, and the users can modify the host and services but not create the services.
I just tried this in XI 5.8.2 and I can create hosts/services as the regular user when Limited is selected for the CCM permissions.
bseuser
Posts: 39
Joined: Thu Jul 02, 2020 2:33 am

Re: Using Nagios API updating(XPUT) hostgroup is failing

Post by bseuser »

Thanks for submitting the feature request. We will wait to see this.

And, I tried with the non-admin user to access the endpoint it says Authentication error. As per lmiltchev said GET/POST/PUT/DELETE will work only for admin.

What are the object endpoints? objects mean: host, service, contact, group, timeperiod, etc., is this correct?

I tried with the GET command and not able to get the request. I got the below error.

Code: Select all

% curl -XGET "http://nagiosxidev/nagiosxi/api/v1/config/host?apikey=DD2CSVkL2TmpCGhlVNbLt5snuTYXeo77h8Z9jjbFsQk4sFJIITprfbSM47KhO7H5&pretty=1"
{
    "error": "Authenticiation failed."
}
Is anything I am missing here?

Thanks
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Using Nagios API updating(XPUT) hostgroup is failing

Post by benjaminsmith »

Hi,
What are the object endpoints? objects mean: host, service, contact, group, timeperiod, etc., is this correct
The objects endpoints are the following:
GET objects/hoststatus
GET objects/servicestatus
GET objects/logentries
GET objects/statehistory
GET objects/comment
GET objects/downtime
GET objects/contact
GET objects/host
GET objects/service
GET objects/hostgroup
GET objects/servicegroup
GET objects/contactgroup
GET objects/timeperiod
Unconfigured Objects

GET objects/unconfigured

Group Members
GET objects/hostgroupmembers
GET objects/servicegroupmembers
GET objects/contactgroupmembers

Data Exporting
GET objects/rrdexport
GET objects/cpexport
GET objects/hostavailability
GET objects/serviceavailability
GET objects/sla
GET objects/bpi
The command is running against the config endpoint so this will not work with a user account. Try running the following (change the IP and API key to your settings).

Code: Select all

curl -XGET "https://192.168.23.112/nagiosxi/api/v1/objects/hoststatus?apikey=AAXHBIAkAHq5L7nnrHdgah5RKMi7b4uKDrIrqu5ZcukdFKTmH7FRnZInLhtdk0dd&pretty=1"
--Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked