THold 0.4.3 emails don't contain graphs?

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
prospero63
Posts: 48
Joined: Sun Apr 12, 2009 7:51 pm

THold 0.4.3 emails don't contain graphs?

Post by prospero63 »

All,

I upgraded to 0.4.3 and when I did, none of my notification emails contain the graph anymore, they all report:

Error while opening;

I rolled back to 0.4.2 and everything is working fine, so it looks like there might be a bug with 0.4.3. Has anyone else seen this?

EDIT: BTW, I'm running 0.8.7g with PIA 2.9 on Windows.
sukanta
Cacti User
Posts: 139
Joined: Tue Jan 26, 2010 6:12 am

Re: THold 0.4.3 emails don't contain graphs?

Post by sukanta »

Hi,
Graph is coming but in .jpeg format earlier .png.. & it is doing via php-gd.If php-gd not Change followings in thold_functions.php

Existing:Line 1456:
data = png2jpeg(rrdtool_function_graph($val['local_graph_id'], $val['rra_id'], $graph_data_array));

Proposed:
$data = rrdtool_function_graph($val['local_graph_id'], $val['rra_id'], $graph_data_array);

Existing: Line 1459
if ($Mailer->attach($data, $val['filename'].'.jpg', 'image/jpg', 'inline', $cid) == false) {

Proposed:
if ($Mailer->attach($data, $val['filename'].'.png', 'image/png', 'inline', $cid) == false) {

Followings are the change-log:

----[ Changelog
--- 0.4.3 ---
Add support for maint plugin
Fix to allow Add Wizard to show all datasources belonging to a graph (even when in separate data templates)
Re-apply SQL speed up when polling
Several fixes to Baselining
Several fixes to CDEFs
Add customizable subjects and message body for down host alerts

After installing this thold total polling time reduced by 30 second!

Hi Jimmy,
Any selectable option for keeping the embedded mail image to .png as .jpeg reduce the quality.
dignome
Posts: 8
Joined: Sat Jan 29, 2011 4:01 pm

Re: THold 0.4.3 emails don't contain graphs?

Post by dignome »

Hi. I had this problem as well and use cacti on windows.

Looking at the png2jpeg function definition at the bottom of thold_functions.php, it is using '/tmp/' for writing the temp file.

Offending line:
$fn = "/tmp/" . time() . '.png';

Proposed fix:
$fn = sys_get_temp_dir() . DIRECTORY_SEPARATOR . time() . '.png';

You need PHP >= 5.2.1 and according to the comments at http://php.net/manual/en/function.sys-get-temp-dir.php this is probably not be the best approach.
User avatar
willieb
Cacti User
Posts: 160
Joined: Thu Jan 22, 2009 10:09 am
Location: South GA

Re: THold 0.4.3 emails don't contain graphs?

Post by willieb »

dignome wrote:Hi. I had this problem as well and use cacti on windows.

Looking at the png2jpeg function definition at the bottom of thold_functions.php, it is using '/tmp/' for writing the temp file.

Offending line:
$fn = "/tmp/" . time() . '.png';

Proposed fix:
$fn = sys_get_temp_dir() . DIRECTORY_SEPARATOR . time() . '.png';

You need PHP >= 5.2.1 and according to the comments at http://php.net/manual/en/function.sys-get-temp-dir.php this is probably not be the best approach.
I am running Cacti or Windows 2003 Server and this worked for me. Thanks.
-willieb
freetimes
Posts: 1
Joined: Thu Sep 27, 2012 4:07 pm

Re: THold 0.4.3 emails don't contain graphs?

Post by freetimes »

dignome wrote:Hi. I had this problem as well and use cacti on windows.

Looking at the png2jpeg function definition at the bottom of thold_functions.php, it is using '/tmp/' for writing the temp file.

Offending line:
$fn = "/tmp/" . time() . '.png';

Proposed fix:
$fn = sys_get_temp_dir() . DIRECTORY_SEPARATOR . time() . '.png';

You need PHP >= 5.2.1 and according to the comments at http://php.net/manual/en/function.sys-get-temp-dir.php this is probably not be the best approach.
Many Thanks dear "dignome"

It works like a charm for me also

(Using Cacti on Win 2003)

cheers
jm72
Posts: 1
Joined: Fri Oct 26, 2012 9:33 am

Re: THold 0.4.3 emails don't contain graphs?

Post by jm72 »

dignome wrote:Hi. I had this problem as well and use cacti on windows.

Looking at the png2jpeg function definition at the bottom of thold_functions.php, it is using '/tmp/' for writing the temp file.

Offending line:
$fn = "/tmp/" . time() . '.png';

Proposed fix:
$fn = sys_get_temp_dir() . DIRECTORY_SEPARATOR . time() . '.png';

You need PHP >= 5.2.1 and according to the comments at http://php.net/manual/en/function.sys-get-temp-dir.php this is probably not be the best approach.
Thanks very much dignome!
Strangely never had this problem on Windows 2003 server running 0.8.8a/Thold 0.4.9, but got it when moved to Win2008 R2.
The above change fixed the "error while opening:" missing email image issue for me.
Cheers
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: THold 0.4.3 emails don't contain graphs?

Post by BSOD2600 »

Bug created to track this issue - http://bugs.cacti.net/view.php?id=2309 as it's still present in 0.4.9
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests