Page 1 of 1

Downloading Graphs via API/Direct Link

Posted: Wed Aug 15, 2018 4:23 am
by JGCG
Hi,

Is it possible to download the performance graphs via the API, or is there a way of getting a direct link to the image itself?
I have Nagios auto logging tickets in our ITSM tool and would like the performce graph adding to the call when it is logged.

I've read the following article: https://support.nagios.com/kb/article.php?id=91 which details how to link directly to graph explorer graphs, but not how to link directly to a JPG or PNG image or how to automatically extract the graph from this page.

Thanks.

Re: Downloading Graphs via API/Direct Link

Posted: Wed Aug 15, 2018 1:58 pm
by cdienger
I can file a feature request for accessing the graph images directly, but right now it isn't readily available. Raw data is available through the API though. See Help > REST API Docs > Objects Reference > Data Exporting, for examples and details.

Re: Downloading Graphs via API/Direct Link

Posted: Thu Aug 16, 2018 7:14 am
by JGCG
cdienger wrote:I can file a feature request for accessing the graph images directly, but right now it isn't readily available. Raw data is available through the API though. See Help > REST API Docs > Objects Reference > Data Exporting, for examples and details.
If you could, that would be great.

I've done some digging and I'm able to extract the graphs I need using the depreciated backend API:

Code: Select all

https://nagios/nagiosxi/includes/components/perfdata/graphApi.php?host=THEHOST&view=2&username=APIUSERNAME&ticket=APIKEY
The graph it returns is not a pretty as the normal, but for now it will do.

Edit: Scrap that, the backend API only works if you're logged in to the UI.
It seems a recent upgrade has disabled the ability from editing the settings of the 'Backend API URL' in the 'Manage Components' section so my old token key from a few months back does not work.
https://nagios/nagiosxi/admin/component ... kendapiurl returns ' Component function does not exist.'

There's been quite a few REST API changes too recently which have not been docmented or mentioned in the change logs!

Re: Downloading Graphs via API/Direct Link

Posted: Thu Aug 16, 2018 1:14 pm
by scottwilkerson
Under Admin -> System Settings -> Backwards Comparability Tab you can re-enable to old ticket system

Re: Downloading Graphs via API/Direct Link

Posted: Thu Sep 13, 2018 11:46 am
by Sampath.Basireddy
With Backward Compatibility enabled, I still don't see "wrench and screwdriver" icon against Backend API URL to get the Ticket for users.

Any other steps to to performed?

Re: Downloading Graphs via API/Direct Link

Posted: Thu Sep 13, 2018 12:01 pm
by lmiltchev
After you've enabled the Backward Compatibility, you can go to Admin > Manage Users > <any user> > Edit. On the right-hand side you should wee the Insecure Login Settings for your user, along with the ticket. Make sure that you select the box to ensure that insecure login is enabled for this user. You could also generate a new insecure ticket if needed.
example01.PNG

Re: Downloading Graphs via API/Direct Link

Posted: Thu Sep 13, 2018 1:12 pm
by Sampath.Basireddy
Perfect, that worked. Thank so much @lmiltchev

Re: Downloading Graphs via API/Direct Link

Posted: Thu Sep 13, 2018 1:42 pm
by lmiltchev
I am glad I could help! :)