Hello,
I would like to view RRD graphs on a remote server.
Does Nagios XI have an API? The only solution i have found is rsync the data to the other server
RRD graph api
Re: RRD graph api
1. If you can access the XI web ui frontend, you could always look at the graphs that way.
2. You could also look at the graph explorer component. There is a fetch_rrd php function that could be snipped and altered.
3. You can access the graphs directly through a url:
For example:
Replace XI_SERVER_IP with the address of your nagios server and HOST_IP with the host you want to view. There are also some timeframe parameters that you can pass at the end. If you are curious what the direct urls for your hosts and services are, go into XI --> host or service details --> Click an host/service --> go to the performance graphs tab --> Right click and copy the image url for a graph --> paste it into your browser and you should have the direct url for the graph.
2. You could also look at the graph explorer component. There is a fetch_rrd php function that could be snipped and altered.
3. You can access the graphs directly through a url:
For example:
Code: Select all
https://XI_SERVER_IP/nagiosxi/includes/components/perfdata/graphApi.php?host=HOST_IP&service=_HOST_&source=1&view=1&start=&end=&rand=1365528046Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: RRD graph api
abrist,
Thank you for your fast responce.
Is there any way to authenticate from URL?
I get "Your session has timed out." if i view it from a computer that is not logged into Nagios XI
Thank you for your fast responce.
Is there any way to authenticate from URL?
I get "Your session has timed out." if i view it from a computer that is not logged into Nagios XI
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: RRD graph api
Yes using a series of post and get requests it would look similar to:
Client request Server Response
GET nagiosxi/login.php -> nagiosxi/login.php cookie nagiosxi=[string]
GET nagiosxi/ajaxhelper.php... -> param nsp=[string]
POST nagiosxi/login.php &page=auth&debug=&pageopt=login&username=[Nagiosuser]&password=[NagiosPassword]&loginButton=Login
You will request login.php for the initial cookie identified by the string nagiosxi=
After a few automate redirects and requests through pages provided by the server, your browser or script provides the cookie and gets a response including an nsp token.
Finally, you can post to login.php with the additional parameters of:
nsp=[string]
page=auth
debug=
pageopt=login
username=[NagiosUser]
password=[NagiosPassword]
loginButton=Login
Once this post is made successfully, you will only need to pass the nagiosxi cookie id and tag to continue with the same session.
Client request Server Response
GET nagiosxi/login.php -> nagiosxi/login.php cookie nagiosxi=[string]
GET nagiosxi/ajaxhelper.php... -> param nsp=[string]
POST nagiosxi/login.php &page=auth&debug=&pageopt=login&username=[Nagiosuser]&password=[NagiosPassword]&loginButton=Login
You will request login.php for the initial cookie identified by the string nagiosxi=
After a few automate redirects and requests through pages provided by the server, your browser or script provides the cookie and gets a response including an nsp token.
Finally, you can post to login.php with the additional parameters of:
nsp=[string]
page=auth
debug=
pageopt=login
username=[NagiosUser]
password=[NagiosPassword]
loginButton=Login
Once this post is made successfully, you will only need to pass the nagiosxi cookie id and tag to continue with the same session.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: RRD graph api
@sreinhart: There's an easier way
Yes, you can use the Backend API URl component to fetch a user's backend ticket. So if you added to that URL:
&username=myuser&ticket=knaonj808an
You should be able to fetch the graph that way.
Yes, you can use the Backend API URl component to fetch a user's backend ticket. So if you added to that URL:
&username=myuser&ticket=knaonj808an
You should be able to fetch the graph that way.
Re: RRD graph api
sreinhardt,
i have been trying your method with curl but i am getting the message "NSP: Sorry Dave, I can't let you do that" on screen.
What am i doing wrong?
i have been trying your method with curl but i am getting the message "NSP: Sorry Dave, I can't let you do that" on screen.
What am i doing wrong?
Re: RRD graph api
The auth is failing because the URL is missing an additional session token. Try the backend ticket method and see if that works.