Page 1 of 1

NagiosXI API URL

Posted: Mon Aug 20, 2018 10:52 pm
by Gonela
Hi Team,

May i know the API URL for adding the comments on particular host and service ? Using API URL.

Re: NagiosXI API URL

Posted: Tue Aug 21, 2018 9:03 am
by lmiltchev
You can see an example here:

Help > REST API Docts > System Reference > POST system/corecommand

Code: Select all

curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/system/corecommand?apikey=LTltbjobR0X3V5ViDIitYaI8hjsjoFBaOcWYukamF7oAsD8lhJRvSPWq8I3PjTf7" -d "cmd=ADD_HOST_COMMENT;localhost;1;%user%;This is a test comment"

{
    "cmd": "ADD_HOST_COMMENT;localhost;1;nagiosadmin;This is a test comment",
    "success": "Core command submitted"
}

Re: NagiosXI API URL

Posted: Mon Sep 10, 2018 1:28 am
by Gonela
Hi ,

i'm trying to running the below command . getting following error

Syntax : curl -XPOST "http://xxxxx/nagiosxi/api/v1/system/cor ... y=hsa7lrke" -d "cmd=ADD_HOST_COMMENT;lanpcorp01.ffx.jfh.com.au;1;nagiostosnow;This is a test comment"

output :

{
"error": "Invalid API Key"
}

But using same API key : GET command is working

Re: NagiosXI API URL

Posted: Mon Sep 10, 2018 9:35 am
by lmiltchev
Are you running the GET command in a browser after you authenticated (logged in as the "nagiostosnow" user)? Please show us the GET command, run from the CLI along with the output of it.

What is the version of Nagios XI that you are currently using? What kind of permissions the "nagiostosnow" user has?