Page 1 of 1

Displaying Nagios CGI Images/Graphs on Remote Web Server

Posted: Thu Jan 15, 2015 12:04 pm
by mgaribaldi
Hello everyone,

We are working to create a web page that will be a dashboard for NMS and I am trying to display the Nagios CGI images that are generated for specific hosts and services under "Trends" and "Availablity". I have attached an example of the image I am trying to display.

I don't mean for this discussion to become about Apache and HTML but wanted to ask the amazing users in this forum how they did it?

I have the following added to a web page on a remote server which displays this image but also requires a login to view these images.

Code: Select all

<!DOCTYPE html>
<html>

<body>
 <img src="http://nagiosserver/cgi-bin/nagios3/trends.cgi?createimage&t1=1420591677&t2=1421196477&assumeinitialstates=yes&assumestatesduringnotrunning=yes&initialassumedhoststate=0&initialassumedservicestate=0&assumestateretention=yes&includesoftstates=no&host=<hostname>&backtrack=8&zoom=4" > 
</body>

</html>
Thanks again!
Michael

Re: Displaying Nagios CGI Images/Graphs on Remote Web Server

Posted: Thu Jan 15, 2015 7:35 pm
by Box293
Does putting the username:password@nagiosserver work for you?

Code: Select all

<img src="http://username:password@nagiosserver/cgi-bin/nagios3/trends.cgi?createimage&t1=1420591677&t2=1421196477&assumeinitialstates=yes&assumestatesduringnotrunning=yes&initialassumedhoststate=0&initialassumedservicestate=0&assumestateretention=yes&includesoftstates=no&host=<hostname>&backtrack=8&zoom=4" >

Re: Displaying Nagios CGI Images/Graphs on Remote Web Server

Posted: Mon Jan 19, 2015 2:59 pm
by abrist
Let us know if this helped OP.

Re: Displaying Nagios CGI Images/Graphs on Remote Web Server

Posted: Tue Jan 20, 2015 4:59 pm
by mgaribaldi
That did help. Thank you!

What I'm going to do is create a read only account and put that user's creds in the URL instead of the placing the nagiosadmin accounts.

I'm also looking into encrypting the password in the URL.

In addition to this, I have a bash script that runs on a cron job that changes the epoch time (t1=epoch time minus 1 day, t2=current epoch time) in my HTML code to solve that issue.

This post helped me as well:
http://stackoverflow.com/questions/2799 ... 5#28053335

Thanks again!

Michael

Re: Displaying Nagios CGI Images/Graphs on Remote Web Server

Posted: Wed Jan 21, 2015 2:50 pm
by abrist
mgaribaldi wrote: I'm also looking into encrypting the password in the URL.
I doubt this is possible with basic auth.