Displaying Nagios CGI Images/Graphs on Remote Web Server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
mgaribaldi
Posts: 26
Joined: Thu Nov 06, 2014 1:58 pm

Displaying Nagios CGI Images/Graphs on Remote Web Server

Post 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
Attachments
trends.cgi.png
trends.cgi.png (10.97 KiB) Viewed 1551 times
"We all float down here...."
-Pennywise
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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" >
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

Let us know if this helped OP.
Former 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.
User avatar
mgaribaldi
Posts: 26
Joined: Thu Nov 06, 2014 1:58 pm

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

Post 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
"We all float down here...."
-Pennywise
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

mgaribaldi wrote: I'm also looking into encrypting the password in the URL.
I doubt this is possible with basic auth.
Former 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.
Locked