Nectar Plugin

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

blmcmb
Posts: 8
Joined: Thu Dec 17, 2009 10:05 am

Pb Attachement

Post by blmcmb »

Hi,

I replace in function mg_send_mail

Code: Select all

 $message = str_replace('<GRAPH>', "<br><br><img src='cid:$cid'>", $message);
by

Code: Select all

 $message .= "<img  src='cid:$cid'>";  
and it works fine now....
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Re: Pb Attachement

Post by mcutting »

blmcmb wrote:Hi,

I replace in function mg_send_mail

Code: Select all

 $message = str_replace('<GRAPH>', "<br><br><img src='cid:$cid'>", $message);
by

Code: Select all

 $message .= "<img  src='cid:$cid'>";  
and it works fine now....
Great find! Works for me using MSExchange :)
However, still broken under POSTFIX. I use Postfix from Cacti to send out email alerts, as I don't want to rely on my M$ products to send mail if they are busted :(

Got to be something to do with Postscript...
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Now isn't that buggy. The <GRAPH> tag is required to place your images within the report. Don't know why this is happening. Although, I would have to dig in.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
lcano
Cacti User
Posts: 190
Joined: Thu Oct 09, 2008 5:46 pm
Location: Spain

Re: Pb Attachement

Post by lcano »

blmcmb wrote:Hi,

I replace in function mg_send_mail

Code: Select all

 $message = str_replace('<GRAPH>', "<br><br><img src='cid:$cid'>", $message);
by

Code: Select all

 $message .= "<img  src='cid:$cid'>";  
and it works fine now....
Don't agree.

I replaced line 474 in nectar_functions.php, which is where I found that code line, and it doesn't work properly. Test report with two graphs, and it only send the first one as inline graph (even not complete). The second one is still sent as attachment.

Thanks anyway, but still something to troubleshoot.
blmcmb
Posts: 8
Joined: Thu Dec 17, 2009 10:05 am

Pb Attachement

Post by blmcmb »

For me it works with 2 graphs! But in my file, it's line 493 !!
User avatar
lcano
Cacti User
Posts: 190
Joined: Thu Oct 09, 2008 5:46 pm
Location: Spain

Post by lcano »

Which version?
User avatar
Hyperlord
Cacti User
Posts: 211
Joined: Tue Feb 10, 2009 3:24 am
Location: Frankfurt (a.M.), Germany

Post by Hyperlord »

This sucks like hell, we need the same codebase.

Anyway it doesen't work with GroupWise neither...
Om Tat Sat
blmcmb
Posts: 8
Joined: Thu Dec 17, 2009 10:05 am

Pb Attachement

Post by blmcmb »

CACTI: 0.8.7e
Nectar:0.11
tontonitch
Posts: 1
Joined: Mon Jan 11, 2010 10:24 am

Post by tontonitch »

Hi,

Hereunder a fix for the nectar_functions.php file (nectar 0.11):

Sorry for the line numbers, I added some debug lines so it could not match on the original file.

about line 322:
change

Code: Select all

        }
} elseif ($item['item_type'] == NECTAR_ITEM_TEXT) {
to

Code: Select all

        }
        $message .= "<p align='" . $alignment[$item["align"]] . "' ><GRAPH></p>";
} elseif ($item['item_type'] == NECTAR_ITEM_TEXT) {
Also correct the following line (about line 484) as the function strstr returns TRUE or FALSE:
change

Code: Select all

if (is_array($data_array) && !empty($data_array) && strstr($message, '<GRAPH>') !==0) {
to

Code: Select all

if (is_array($data_array) && !empty($data_array) && strstr($message, '<GRAPH>') ) {
Keep the line previously discussed (about line 492):

Code: Select all

$message = str_replace('<GRAPH>', "<br><br><img src='cid:$cid'>", $message);
That should fix the problem, and keep the image position property working (left/right/center the image)

I still have a problem on Lotus Notes, where the images are not found. It may be related to the ids of the inline attached images, containing a "@". It still needs some investigations. If anyone has an idea...

Anyway, nice plugin, well done Gandalf!

Cheers,

Yannick

:edit: Lotus Notes problem fixed, as inline png are not supported before lotus notes 8.5. jpeg and gif are well supported.
User avatar
zoemu
Cacti User
Posts: 287
Joined: Fri Jul 10, 2009 1:38 pm
Location: Toronto, Canada

Post by zoemu »

Hi:

I have Nectar installed properly but whebn creating email report to be sent the following dates are being display on upcoming events 1970 ???

Code: Select all


08/01/1970 07:00:00 - Thursday 
15/01/1970 19:00:00 - Thursday 
23/01/1970 07:00:00 - Friday 
30/01/1970 19:00:00 - Friday 
07/02/1970 07:00:00 - Saturday 
14/02/1970 19:00:00 - Saturday 
22/02/1970 07:00:00 - Sunday 
01/03/1970 19:00:00 - Sunday 
09/03/1970 07:00:00 - Monday 
16/03/1970 19:00:00 - Monday 
24/03/1970 07:00:00 - Tuesday 
31/03/1970 19:00:00 - Tuesday 
08/04/1970 07:00:00 - Wednesday 
15/04/1970 19:00:00 - Wednesday 
Mi cacti is installed on Windows......
Last edited by zoemu on Mon Jan 18, 2010 11:31 am, edited 1 time in total.
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

tontonitch wrote:Hi,

Hereunder a fix for the nectar_functions.php file (nectar 0.11):

Sorry for the line numbers, I added some debug lines so it could not match on the original file.

about line 322:
change

Code: Select all

        }
} elseif ($item['item_type'] == NECTAR_ITEM_TEXT) {
to

Code: Select all

        }
        $message .= "<p align='" . $alignment[$item["align"]] . "' ><GRAPH></p>";
} elseif ($item['item_type'] == NECTAR_ITEM_TEXT) {
Also correct the following line (about line 484) as the function strstr returns TRUE or FALSE:
change

Code: Select all

if (is_array($data_array) && !empty($data_array) && strstr($message, '<GRAPH>') !==0) {
to

Code: Select all

if (is_array($data_array) && !empty($data_array) && strstr($message, '<GRAPH>') ) {
Keep the line previously discussed (about line 492):

Code: Select all

$message = str_replace('<GRAPH>', "<br><br><img src='cid:$cid'>", $message);
That should fix the problem, and keep the image position property working (left/right/center the image)

I still have a problem on Lotus Notes, where the images are not found. It may be related to the ids of the inline attached images, containing a "@". It still needs some investigations. If anyone has an idea...

Anyway, nice plugin, well done Gandalf!

Cheers,

Yannick

:edit: Lotus Notes problem fixed, as inline png are not supported before lotus notes 8.5. jpeg and gif are well supported.
Tried all of the above, but unfortunately still not working with postfix. THOLD seems to work just fine.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
blmcmb
Posts: 8
Joined: Thu Dec 17, 2009 10:05 am

Post by blmcmb »

Dont working with Zimbra !!!!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

zoemu wrote:Hi:

I have Nectar installed properly but whebn creating email report to be sent the following dates are being display on upcoming events 1970 ???

Code: Select all


08/01/1970 07:00:00 - Thursday 
15/01/1970 19:00:00 - Thursday 
23/01/1970 07:00:00 - Friday 
30/01/1970 19:00:00 - Friday 
07/02/1970 07:00:00 - Saturday 
14/02/1970 19:00:00 - Saturday 
22/02/1970 07:00:00 - Sunday 
01/03/1970 19:00:00 - Sunday 
09/03/1970 07:00:00 - Monday 
16/03/1970 19:00:00 - Monday 
24/03/1970 07:00:00 - Tuesday 
31/03/1970 19:00:00 - Tuesday 
08/04/1970 07:00:00 - Wednesday 
15/04/1970 19:00:00 - Wednesday 
Mi cacti is installed on Windows......
Please post a screenshot of the report settings. I'm not aware of using PHP stuff not available on windows ...
R.
User avatar
zoemu
Cacti User
Posts: 287
Joined: Fri Jul 10, 2009 1:38 pm
Location: Toronto, Canada

Post by zoemu »

Here you go ..

Thank you
Attachments
nectar.png
nectar.png (58.82 KiB) Viewed 3108 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

tontonitch wrote:Hi,

Hereunder a fix for the nectar_functions.php file (nectar 0.11):
Thanks for the hints. Will verify
R.
Locked

Who is online

Users browsing this forum: No registered users and 0 guests