Php – Zabbix PDF Report Generation

pdfPHPreportzabbix

if any of you have an idea how to implement zabbix generate PDF reports? in forum I found some like this: https://www.zabbix.com/forum/showthread.php?t=24998 .

I try implement this to my zabbix 2.2.3 but when I do this I still see Text (Unable to login:) I guess it is a problem version. as you can see it was only tested on 1.8.8 and 1.8.10. Does anyone have some idea?


One problem fixed, is that it is failing due to API version issues, I download fresh from http://zabbixapi.confirm.ch/ and now I can generate PDF report, However, when I have select some site I see only ALL option and PDF is are empty

Below I share screen and example report: http://pl.scribd.com/doc/237807238/file-1

enter image description here

Anybody have some idea ?

Regards
Mick

Best Answer

zabbix-dynamic-pdf-report

zabbix-dynamic-pdf-report module allow us to generate pdf reports. Once implemented we have options to generate reports for ‘Host’, ‘Host Group’ on time range of ‘Hour’, ‘Day’, ‘Week’, ‘Month’, ‘Year’. We can retrieve old report from ‘Old Reports’ section.

Implementation Dependencies

  • php5-curl
  • php5-json

sudo apt-get install php5-curl php5-json

Clone the git repo that contain the module

cd /opt/

git clone https://github.com/SandipSingh14/Zabbix_

Configure zabbix-dynamic-pdf-report according to zabbix-server

vim Zabbix_/zabbix-dynamic-pdf-report/config.inc.php

<?php
//CONFIGURABLE
# zabbix server info(user must have API access)
$z_server       = 'http://zabbix.example.com/';
$z_user      = 'admin';
$z_pass         = 'zabbix';
# Temporary directory for storing pdf data and graphs - must exist 
$z_tmp_path    = './tmp';
# Directory for storing PDF reports
$pdf_report_dir    = './report';
# Root URL to reports
$pdf_report_url    = "./report";
# paper settings
$paper_format    = 'A4'; // formats supported: 4A0, 2A0, A0 -> A10, B0   -> B10, C0 -> C10, RA0 -> RA4, SRA0 -> SRA4, LETTER, LEGAL, EXECUTIVE, FOLIO
$paper_orientation = 'portrait'; // formats supported: portrait / landscape
# time zone - see http://php.net/manual/en/timezones.php
$timezone    = 'Asia/Calcutta';
# Logo used in PDF - may be empty
# TODO: Specify image size!
$pdf_logo    = './images/zabbix.png';
$company_name   = 'Zabbix';
//DO NOT CHANGE BELOW THIS LINE
$z_tmp_cookies     = "/tmp/";
$z_url_index     = $z_server ."index.php";
$z_url_graph    = $z_server ."chart2.php";
$z_url_api    = $z_server ."api_jsonrpc.php";
$z_login_data    = "name=" .$z_user ."&password=" .$z_pass ."&autologin=1&enter=Sign+in";
?>

Change directory and create directory inside zabbix-dynamic-pdf-report

cd Zabbix_/zabbix-dynamic-pdf-report

mkdir tmp report

Change zabbix auth to login method, it’s required for login into zabbix server

sed -i 's,user.authenticate,user.login,g' inc/ZabbixAPI.class.php
sed -i 's,user.authenticate,user.login,g' inc/ZabbixAPI.class.php.org

Copy zabbix-dynamic-pdf-report into /usr/share/zabbix/

cp -r /opt/Zabbix_/zabbix-dynamic-pdf-report /usr/share/zabbix/

Restart apache

service apache2 restart

Procedure to Generate Reports

Open Generate PDF Report page

http:///zabbix-dynamic-pdf-report/index.php

  • Once Opened you can choose report type ‘HOST OR HOSTGROUP’ and click the dropdown to select the hostname or hostgroup name
  • And you can choose report range ‘LAST OR CUSTOM’ and select the dropdown for the time period of report
  • And if you select ‘custom’ in report range then you can select the time period for which you want to generate the report.
  • And click on ‘GENERATE’ button and your report will be generated.
  • Module provides feature of old reports i.e you can see the reports you have generated earlier.
Related Topic