[hobbit] PDF reporting [news] ! First part

Deiss, Mark Mark.Deiss at acs-inc.com
Wed May 3 17:37:52 CEST 2006


Cool.  I wrote standalone scripts in similar vein to generate pdf reports
for BS15000/ISO90000 capacity reports. The scripts generate the png graph
files and then incorporates some html files to build the final pdf file
using htmldoc software package (the non-commercial version).  In our case,
these are meant to be separate reports and are not linked into the hobbit
web pages.
 
One thing that is a bit vexying is configuring rrdtool commands to insert
threshold lines and tailor the graph legends. The rrdtool command syntax
(not hobbit) changes across releases so if anyone is fooling around in these
areas, caveat emptor. I maintain multiple releases of rrdtool sets and go
back and forth between the versions trying to get particular features. 
 
Generating legends that include not only the minimum and maximum graphed
value, but also the last graphed value. Something that management likes to
see. Also for the disk/filesystem utilization percentages, also including
the allocated disk amount in gigabytes. Getting clean auto-formatting for
the legends is a bear.

-----Original Message-----
From: thomas.seglard.enata at cnp.fr [mailto:thomas.seglard.enata at cnp.fr]
Sent: Tuesday, May 02, 2006 11:21 AM
To: hobbit at hswn.dk
Subject: [hobbit] PDF reporting [news] ! First part



Hello, 

I got very good feedbacks on the reports. Thank you for these ! 
Now, I'm going to explain how it works. You got two parts. On one hand, some
shell scripts will generate the rrd graphs and save them as PNG. In other
hand, a php page will do the reports with the (GREAT) help of the libfpdf. 

Before I go further, I want to say that I created a directory called 'pdf'
into @HOBBITSERVERHOME/www/ In addition, I make an 'images', 'graphrrd',
'export' directories. In conclusion, I got the 'pdf' directory organized
like this : 

[hobbit at psi200 pdf]$ ls -al 
total 164 
drwxr-xr-x    6 hobbit hobbit  4096 mai  2 14:52 . 
drwxr-xr-x   30 hobbit hobbit  4096 mai  2 15:25 .. 
drwxr-xr-x    5 hobbit hobbit  4096 avr 30 23:59 export 
drwxrwxr-x  157 hobbit hobbit  4096 avr 28 19:20 graphrrd 
drwxrwxr-x    2 hobbit hobbit  4096 mar 22 18:31 images 
-rwxrwxr-x    1 hobbit hobbit  5251 mar 22 15:52 pdf.php 
-rwxrwxr-x    1 hobbit hobbit 52241 avr 21 19:53 rapport.php 
-rwxrwxr-x    1 hobbit hobbit 11125 avr 11 16:17 rapportredac.php 
-rwxrwxr-x    1 hobbit hobbit  7459 avr 10 15:31 rapports_annuels.php 
-rwxrwxr-x    1 hobbit hobbit  8814 avr 10 15:30 rapports_mensuels.php 
drwxrwxr-x    2 hobbit hobbit  4096 mai  2 12:34 scripts 

export : directory where all reports generated automatically go. 
graphrrd : directory where all PNG graphs generated automatically go. 
images : directory where all images to include in the pdf go. I'm giving you
some images in images.zip 
scripts : directory to stock scripts which generate the PNG graphs. 


Ok, let's go ! 
1) first part : shell scripts (rrdscripts.zip). Decompress the scripts into
your 'pdf' directory and edit them to modify the destination of PNGs graphs.
Once done, launch master.sh and look at the results. For one server, you
must have 4 graphs BY test. Actually, I'm graphing 6 tests - cputil, load,
memory, iowait, network (don't work for linux at the moment !!) and
run-queue. You can add more tests if you want ! For example, you will have :


graphrrd/myserver/ 
load.myserver-[day/week/month/year].png 
mem.myserver-[day/week/month/year].png 
... 

Now, you can do a cron to launch master.sh every hour to update your graphs.

Thanks to ED (ed.zehome.com) for his site and his explanation of rrdtool. I
used examples from his site into the scripts... 

2) Second part, the php pages (pdfreports.zip). Put these files directly
into the pdf directory. You have five files : 

- pdf.php --> contains the main form with hobbit's look ! You may add this
page to your hobbit's menu. Simply type in the text field a server name and
got your *beautiful* report :) 
- rapport.php --> contains all the php code. So, the file pdf.php calls this
file when a name is submitted. Within this script you can define 

- rapportredac.php --> contains a form with several textareas. You have to
put a server name, check a box if the server is overloaded, underloaded or
'normally loaded'. Then, all text in the textareas will go under graphs in
the pdf report. You can easily build analysis for your boss or team... Like
pdf.php, this page calls rapport.php. 

- rapports_mensuels (monthly) and rapports_annuels (annual - sorry for
french) : you can execute these scripts to have reports - for all servers -
automatically generated and put into a directory. Like 'master.sh' you can
do a cron to have reports each end of month. These two scripts even check
the last day of month and send a mail when reports are generated. 

If all is correct you will have a pdf report with your graphs in it when you
click on 'rapport !' on the pdf.php page. That's all ! 
You have to edit them by hand to modify and adapt to your configuration. I'm
sorry the code isn't very clean at all ! Moreover, you will have a lot of
french text in the files. I'm beginning to rewrite comments into english. 
Feel free to make comments and/or modifications to the scripts. 

I hope, these reports will satisfy your needs. I'm sorry for the shorts
explanations but I got another project which take all my time... So, I will
try my best to answer questions, if you have some ! 
Best regards, 

Thomas Seglard 



Ce message (et toutes ses pieces jointes eventuelles) est confidentiel et
etabli a l'intention exclusive de ses destinataires.
Toute utilisation de ce message non conforme a sa destination, toute
diffusion ou toute publication, totale ou partielle, est
interdite, sauf autorisation expresse.
L'internet ne permettant pas d'assurer l'integrite de ce message, CNP
Assurances et ses filiales declinent toute responsabilite
au titre de ce message, s'il a ete altere, deforme ou falsifie.

*****

This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither CNP Assurances nor any of its subsidiaries or affiliates shall be
liable for the message if altered, changed or falsified.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20060503/49ceac0c/attachment.html>


More information about the Xymon mailing list