Problems page and image links
Problems page and image links
The "Problems" pages has images all over it. We want to email this page but the image links point to
<IMG SRC='/nagios/images/down.gif...
In the email, they appear as file:///nagios/images/down.gif
Is there a way that we can globally change this image path to the FQDN so they appear in the email?
<IMG SRC='/nagios/images/down.gif...
In the email, they appear as file:///nagios/images/down.gif
Is there a way that we can globally change this image path to the FQDN so they appear in the email?
-
tonyyarusso
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Problems page and image links
I'm sure you could, but it's a little odd. Wouldn't it make more sense to print the page to a PDF and e-mail that, to make sure you send a static copy?
Re: Problems page and image links
wget and perhaps some other tools, like your browser's save function, have methods to correct this problem. I'd start with those and see what you can find
Re: Problems page and image links
Yes, that would. But I am not a programmer and all I am doing is using someone's perl script to send out these reports.
http://exchange.nagios.org/directory/Ad ... er/details
this is what I added to the script
Might you know how to print out the page in PDF with perl?
thanks
http://exchange.nagios.org/directory/Ad ... er/details
this is what I added to the script
Code: Select all
###############################################################################
sub report_current {
$repdateprev = Date_PrevWorkDay("today",1);
debug(1,"repdateprev = $repdateprev");
#2006072116:48:37
$reporturl = "$webbase/cgi-bin/status.cgi?host=all&servicestatustypes=28";
$mailsubject = "Nagios Current alerts for today";
}
###############################################################################
thanks
Re: Problems page and image links
In perl(AKA the Practice Extraction and Report Language), it's certifiably possible. The perl moto is there is more then one way to do every thing, as an exercise we try and discover just how many... or something like that.
Something like this should do it.
Something like this should do it.
Code: Select all
$output ~= s%<IMG SRC='/nagios/image%<IMG SRC='http://(servername)/nagios/image%gRe: Problems page and image links
Other tools???mmestnik wrote:... perhaps some other tools, like your browser's save function...
I'm trying to do this from a script so I can run it with cron.
Re: Problems page and image links
Here is a document that explains how:
http://www.darkspell.com/references/lwpcook.html
http://www.darkspell.com/references/lwpcook.html
-
tonyyarusso
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Problems page and image links
To do it with Perl, I'd look at http://search.cpan.org/dist/PDF-API2/
You could also accomplish this with html2ps and ps2pdf (or ghostscript), or htmldoc, all of which would be scriptable.
You could also accomplish this with html2ps and ps2pdf (or ghostscript), or htmldoc, all of which would be scriptable.
Re: Problems page and image links
I don't have it scripted yet but here are the basics that I came up with
Do a wget
Then convert it to postscript
then convert that to .pdf
Then mail it out
Do a wget
Code: Select all
wget -O status.html --user nagios --password nagios "http://nagiosserver1.company.com/nagios/cgi-bin/status.cgi?host=all&servicestatustypes=28
Code: Select all
html2ps status.html > status.psCode: Select all
ps2pdf status.ps > status.pdfCode: Select all
email -s "Attachment" -a coolpic.jpg [email protected]
You can also redirect text:
email -s "Attachement" -a coolpic.jpg [email protected] < somefile
You can send an empty email with just the attachment:
email -s "Attachment" -a coolpic.jpg -b [email protected]
Re: Problems page and image links
And now that I think about it, this is probably easier
wget -k -O status.html --user nagios --password nagios "http://nagiosdc1.dfckc.com/nagios/cgi-b ... ustypes=28"
the "-k" converts the links in the document to make them suitable for local viewing
then email the html file
wget -k -O status.html --user nagios --password nagios "http://nagiosdc1.dfckc.com/nagios/cgi-b ... ustypes=28"
the "-k" converts the links in the document to make them suitable for local viewing
then email the html file