CereusReporting - PDF Reports - 4.00 for Cacti 1.x out soon!

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

obsolete
Last edited by phalek on Sun Aug 29, 2010 2:26 am, edited 1 time in total.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

phalek wrote:I'm using curl to get some of the images, maybe your php installation is missing it ...

http://de.php.net/curl
yep.
download php_curl.dll and move to \php\ext and modified php.ini
now pdf is downloaded but empty, without graphs :cry:
Cacti v.087g + PAv2.9
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

are there any files/images created in the plugins/nmidCreatePDF/tmp directory ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

phalek wrote:are there any files/images created in the plugins/nmidCreatePDF/tmp directory ?
no, folder is empty
C:\Inetpub\wwwroot\cacti\plugins\nmidCreatePDF\tmp
permisson any full access.
Cacti v.087g + PAv2.9
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

Ha,

seems like I forgot half of the requirements.

Do you have php_gd2.dll installed and enabled ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

phalek wrote:Ha,

seems like I forgot half of the requirements.

Do you have php_gd2.dll installed and enabled ?
yes. i have this file and it work

my php.ini
extension=php_mysql.dll
[PHP_SNMP]
extension=php_snmp.dll
[PHP_SOCKETS]
extension=php_sockets.dll
extension=php_gd2.dll
extension=php_curl.dll

tech view on cacti
curl
--------------------------------------------------------------------------------

cURL support enabled
cURL Information libcurl/7.16.0 OpenSSL/0.9.8i zlib/1.2.3
gd
--------------------------------------------------------------------------------

GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Cacti v.087g + PAv2.9
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

can you access the cacti webpage using localhost ?

e.g
http://127.0.0.1/ or http://127.0.0.1/cacti/

?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

phalek wrote:can you access the cacti webpage using localhost ?

e.g
http://127.0.0.1/ or http://127.0.0.1/cacti/

?
http://127.0.0.1/cacti/ :D
Cacti v.087g + PAv2.9
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

hm, ok.

Now do the following, open the doPDFReport.php file and add the following lines to line 94:

Code: Select all

print "URL: ".$hit[1]." <br>";
print "Image: $imageFile <br><hr>";

so the code block looks

Code: Select all

if ( preg_match("/(.*src=').*(' border.*)/",$line,$lineMatch ) ) {
   #$line = $lineMatch[1].'tmp/image-'.$match[1].'.jpg'.$lineMatch[2];
   $imageFile = "plugins/nmidCreatePDF/tmp/image-".$match[1].".png";
   print "URL: ".$hit[1]." <br>";
   print "Image: $imageFile <br><hr>";
   list($width, $height, $type, $attr) = getimagesize($imageFile); # 160, 60
then try to create a pdf report. it will give you the following errors (probably a bit different to the one here)

Code: Select all

URL: /cacti/graph_image.php?local_graph_id=222&rra_id=0&view_type=tree&graph_start=1229350319&graph_end=1229436719 
Image: plugins/nmidCreatePDF/tmp/image-222.png 
--------------------------------------------------------------------------------
TCPDF error: Some data has already been output, can't send PDF file
If you add the URL to http://127.0.0.1 it should give you a graph image back.
the Image says, where it stores the image file, and what name it uses.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

Code: Select all

			   if ( preg_match("/graph_image.php/",$hit[1] ) ) {
				if ( preg_match("/local_graph_id=(\d+)/",$hit[1],$match ) ) {
				   if ( preg_match("/(.*src=').*(' border.*)/",$line,$lineMatch ) ) {
				      #$line = $lineMatch[1].'tmp/image-'.$match[1].'.jpg'.$lineMatch[2];
					$imageFile = "plugins/nmidCreatePDF/tmp/image-".$match[1].".png";
						print "URL: ".$hit[1]." <br>"; 
						print "Image: $imageFile <br><hr>"; 
					list($width, $height, $type, $attr) = getimagesize($imageFile); # 160, 60
					if ( ( $usedPageUnits + intval ( ( $height / 10) * 2 ) + 10 ) > $pageUnits ) {
then i create pdf report... and no graph on report, only date and my test message on top.
Cacti v.087g + PAv2.9
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

hm.

We're getting close,

You're using windows, so maybe the following line in the doPDFCreate.php file is the problem ( line 73 )

Code: Select all

$dataArray = explode ("\n", $output);
change that to

Code: Select all

 $dataArray = explode ("\n\r", $output);
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

phalek wrote:hm.

We're getting close,

You're using windows, so maybe the following line in the doPDFCreate.php file is the problem ( line 73 )

Code: Select all

$dataArray = explode ("\n", $output);
change that to

Code: Select all

 $dataArray = explode ("\n\r", $output);

Code: Select all

 $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);       
        curl_close($ch);

        $dataArray = explode ("\n\r", $output); 
and nothing ((( no graph on page
Cacti v.087g + PAv2.9
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

ok,

i'm going to setup a windows cacti version to test that ...
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

Ok, found the error.

FIrst of all, you will need to have anonymous access to view the graphs...
I couldn't figure out how to get the images otherweise right now ...


Next,

in the setup.php at line 56, remove the following part from that big if section:

Code: Select all

&& PHP_OS!='WINNT'
so the whole function looks like

Code: Select all

function nmidCreatePDF_graph_set_options($opt) {
    #//do not cache graphs being edited or zoomed
    if ( !(isset($_REQUEST['action']) && in_array($_REQUEST['action'],array('zoom','properties','edit'))) && !(isset($opt['output_flag']) && $opt['output_flag']==RRDTOOL_OUTPUT_STDERR) )
        $opt['output_flag']=RRDTOOL_OUTPUT_STDOUT;
    return $opt;
}
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

phalek wrote:Ok, found the error.

FIrst of all, you will need to have anonymous access to view the graphs...
I couldn't figure out how to get the images otherweise right now ...


Next,

in the setup.php at line 56, remove the following part from that big if section:

Code: Select all

&& PHP_OS!='WINNT'
so the whole function looks like

Code: Select all

function nmidCreatePDF_graph_set_options($opt) {
    #//do not cache graphs being edited or zoomed
    if ( !(isset($_REQUEST['action']) && in_array($_REQUEST['action'],array('zoom','properties','edit'))) && !(isset($opt['output_flag']) && $opt['output_flag']==RRDTOOL_OUTPUT_STDERR) )
        $opt['output_flag']=RRDTOOL_OUTPUT_STDOUT;
    return $opt;
}
i change code in file, but i not understand this
FIrst of all, you will need to have anonymous access to view the graphs...
guest account or graph? graphs are generated...
or you say about anonymous on ntfs permission?
Cacti v.087g + PAv2.9
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest