api to add comment

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

api to add comment

Post by BanditBBS »

Am I blind or is there no endpoint to add a comment? I want our ticketing system to add a comment of the ticket # when it gets an alert from Nagios.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: api to add comment

Post by benjaminsmith »

Hi Bandit,

The way to do that would be to use POST system/corecommand endpoint to send a Core command that will add a comment.

For example:

Code: Select all

curl -XPOST "https://192.168.23.113/nagiosxi/api/v1/system/corecommand?apikey=sCWXTQ3rHtm483AgRUUtLi04v5ECCVmktCCGoU8mINpPPflWafJbRKeGO8fGjUh6" -d "cmd=ADD_HOST_COMMENT;localhost;1;%user%;This is a test comment"
Let me know if that works for you.

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!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: api to add comment

Post by BanditBBS »

This will work, but what permissions are needed? I had a read only user that it wouldn't work even though they had API access. I then changed to this and still get Authentication failed
permissions.jpg
I tried it with my admin user's api key and it works great.
You do not have the required permissions to view the files attached to this post.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: api to add comment

Post by ssax »

Currently regular users only have access to the objects API endpoint, they would need to be an admin to use the other endpoints (system/config/etc).
Locked