Ad Widget

Collapse

Zabbix Dynamic PDF Report Generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srinivasreddykesari
    Junior Member
    • Dec 2018
    • 4

    #376
    Hi All,

    I'm new to Zabbix. I have installed Zabbix 4.0 recently on centOs and it is running good. I wanted to generate zabbix report in PDF and came across this link " https://github.com/martinm76/zabbix-pdf-report " by martinm76. I downloaded and configured based on the instructions in that link. But still I'm not able to launch report UI.It says 404 not found.

    Here is want I did.

    1. Download https://github.com/martinm76/zabbix-pdf-report and unzipped in /etc/zabbix as root user.

    [root@localhost zabbix]# ls
    web zabbix-pdf-report-master zabbix-pdf-report-master.zip zabbix_server.conf zabbix_server.conf.bak
    [root@localhost zabbix]#

    [root@localhost zabbix]# cd zabbix-pdf-report-master/
    [root@localhost zabbix-pdf-report-master]# ls
    Changelog chooser.php config.inc.php config.inc.php.dist createpdf.php css fixrights.sh fonts images inc index.php js LICENSE logout.php README.md reports tmp
    [root@localhost zabbix-pdf-report-master]#

    2. Ran fixrights.sh script which created reports and tmp dir in /etc/zabbix/zabbix-pdf-report-master/ folder

    3. Configured config.inc.php variables .

    $user_login=0;
    # zabbix server info(user must have API access)
    // $z_server = 'http://localhost/zabbix/';
    $z_server = 'http://10.x.x.x/zabbix/'; // Replace YourServerHere with either en IP or an FDQN (e.g. zabbix.company.com). Remove the s in https if for some reason you don't use https yet. Or better yet, get Let's Encrypt installed and use https!
    $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 = './reports';
    # Root URL to reports
    #$pdf_report_url = $z_server ."report/reports";
    $pdf_report_url = "./reports";

    4) I have php5.4 installed

    [root@localhost zabbix-pdf-report-master]# rpm -qa | grep php
    php-mysql-5.4.16-46.el7.x86_64
    php-gd-5.4.16-46.el7.x86_64
    php-common-5.4.16-46.el7.x86_64
    php-5.4.16-46.el7.x86_64
    php-bcmath-5.4.16-46.el7.x86_64
    php-cli-5.4.16-46.el7.x86_64
    php-ldap-5.4.16-46.el7.x86_64
    php-mbstring-5.4.16-46.el7.x86_64
    php-xml-5.4.16-46.el7.x86_64
    php-pdo-5.4.16-46.el7.x86_64

    5) I have curl

    [root@localhost zabbix-pdf-report-master]# curl --version
    curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.36 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
    Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
    Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets

    [root@localhost zabbix]# php -i | grep -i curl
    /etc/php.d/curl.ini,
    curl
    cURL support => enabled
    cURL Information => 7.29.0


    My questions are
    1) what is the proper value for $pdf_report_url in my case?
    2) What will be the url to lanuch reports UI?
    3) I unzipped package as root user. Is this correct?.
    4) do I need php-curl even though I have curl?

    Spent so much of time on fixing it but no use. I need helping hand please.
    Last edited by srinivasreddykesari; 31-12-2018, 05:19.

    Comment

    • StageZabb
      Junior Member
      • Jan 2019
      • 1

      #377
      Hi, how can i generate this PDF automatically for each of my host, plus you have to update this pdf every month. Could someone help me ? A script can be but how?

      Comment

      • leomoras
        Junior Member
        • Oct 2017
        • 1

        #378
        Hello,

        I'm using zabbix 4.0.2 and pdf report version 1.1.1.

        When
        PHP Code:
        $user_login=0
        in config.inc.php,

        change this in index.php, line 11

        Code:
        if ( $user_login = 0 ) {
          header("Location: chooser.php");
          exit(0);
        }
        to

        Code:
        if ( $user_login == 0 ) {
          header("Location: chooser.php");
          exit(0);
        }
        Without that, even you have user_login=0 it will show you the login/password screen.

        ---
        I'm facing this problem when acessing the report page.

        Unable to login:
        And this error on apache log:

        [Tue Jan 29 08:57:17.599879 2019] [:error] [pid 27398] [client 177.35.6.112:19050] PHP Warning: Creating default object from empty value in /---/inc/ZabbixAPI.class.php on line 123

        I have php(5.6.38) and curl(7.29.0). User and password used in config.inc.php is a "Supper Administrator Zabbix".

        Someone can help with that error? Thanks.


        Thanks @martinm76 for the project!

        Comment

        • juha
          Junior Member
          • Feb 2019
          • 1

          #379
          Hi, thanks for this reporting plugin! I'd like to add Windows/Linux services and processes to report but haven't got them to show up with name Processes or Number of processes. I added those to config.inc.php: $items = array and $mygraphs.

          $items = array('Processes'=>'number','system information'=>'string'...
          $mygraphs = '#(Ping|Processes|...
          Or same with 'Number of processes'

          Any advise?

          Comment

          • raul.recinosm
            Junior Member
            • Jun 2018
            • 8

            #380
            Hello, i have install version 1 on zabbix 4.0, but when i am loggin in the page is show me this, i try do this with a administrator user and normal user, same behaivor, any idea?

            Thanks for your help.
            Attached Files

            Comment

            • Aslmafarook
              Junior Member
              • Feb 2019
              • 5

              #381
              Hello Team,

              I am having issue with zabbix-dynamic-pdf generator. I have installed php7.0 for my zabbix-server. While generating the pdf report the image is not shown. Only the topic of the graphs is available.

              I am having another zabbix server it has php 5.59. It will give the proper pdf report

              My suspection is the version of php 7.0 is not supported for the image for pdf.


              Attached Files
              Last edited by Aslmafarook; 28-03-2019, 14:36.

              Comment

              • neqinox
                Junior Member
                • May 2019
                • 11

                #382
                Hi all - I'm having a couple of display problems with this plugin (Zabbix 4.0.7, php 7.3.5, CentOS 7).

                I can get it to generate reports, just fine, however I have a load of text (as shown in my attachment) above the report form.
                Also, when I generate the report, the result page is 100% text; I have to get to the report by manually typing it's filename in the URL.
                Finally, the "Old reports (click to show") URL is not a URL, it's just plain text and doesn't do anything.

                Any ideas at all?
                The only error I can see anywhere is in the apache logs, but I think it might be irrelevant to this problem?;

                PHP Warning: get_class() expects parameter 1 to be object, null given in /usr/share/zabbix/reports/inc/ZabbixAPI.class.php on line 208, referer: http://10.30.194.120/zabbix/screens.php?ddreset=1

                Thanks!
                Attached Files

                Comment

                • neqinox
                  Junior Member
                  • May 2019
                  • 11

                  #383
                  Originally posted by neqinox
                  Hi all - I'm having a couple of display problems with this plugin (Zabbix 4.0.7, php 7.3.5, CentOS 7).

                  I can get it to generate reports, just fine, however I have a load of text (as shown in my attachment) above the report form.
                  Also, when I generate the report, the result page is 100% text; I have to get to the report by manually typing it's filename in the URL.
                  Finally, the "Old reports (click to show") URL is not a URL, it's just plain text and doesn't do anything.

                  Any ideas at all?
                  The only error I can see anywhere is in the apache logs, but I think it might be irrelevant to this problem?;

                  PHP Warning: get_class() expects parameter 1 to be object, null given in /usr/share/zabbix/reports/inc/ZabbixAPI.class.php on line 208, referer: http://10.30.194.120/zabbix/screens.php?ddreset=1

                  Thanks!
                  Fixed. It seems php v7 is not supported; rolled it back to 5 and all is well, however the 'click to show old reports' link still isn't working.

                  Comment

                  • darklord20k
                    Member
                    • Dec 2017
                    • 32

                    #384
                    Hi all,
                    I'm using v 1.1.1 with zabbix 4.2.1, but i can't get graph about switch/router bandwidth, but icmp ping, CPU, memory still well, any advise?
                    Thanks

                    Comment

                    • irishlemon
                      Junior Member
                      • Jul 2019
                      • 1

                      #385
                      Hi everyone,

                      Firstly thanks martinm_76 for this great work.

                      I'm currently trying to install the catonrug's fork on zabbix 4.2 under centos 7.
                      All is working fine, except that i can't find only one hostgroup (i have three) and the associate hosts.
                      My knowledge of javascript is nearly poor, and i really need some help because zabbix is using in my compagny to supervise our clients.
                      Thanks by advances

                      Comment

                      • loopsky
                        Junior Member
                        • Jul 2019
                        • 1

                        #386
                        Hello, Can anyone help with this error on logs? PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in /usr/share/zabbix/report/inc/ZabbixAPI.class.php:324\nStack trace:\n#0 /usr/share/zabbix/report/inc/ZabbixAPI.class.php(257): ZabbixAPI::__jsonRequest('http://10.10.50...', '{"auth":null,"m...')\n#1 /usr/share/zabbix/report/inc/ZabbixAPI.class.php(285): ZabbixAPI->__callAPI('user.login', Array)\n#2 /usr/share/zabbix/report/inc/ZabbixAPI.class.php(100): ZabbixAPI->__login()\n#3 /usr/share/zabbix/report/index.php(30): ZabbixAPI::login('http://10.10.50...', 'root', '*********')\n#4 {main}\n thrown in /usr/share/zabbix/report/inc/ZabbixAPI.class.php on line 324, referer: http://mnl-zabbix/zabbix/report/
                        I was able to go to the login page but once I click login the result is that the "Page is not working"

                        Comment

                        • venkat
                          Junior Member
                          • Aug 2019
                          • 1

                          #387
                          Could any one help me on this errors while generating reports getting below errors in /etc/httpd/logs

                          [Tue Aug 20 06:24:32.585315 2019] [:error] [pid 6520] [client xxxxxxx:49221] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Tue Aug 20 06:24:44.388743 2019] [:error] [pid 6629] [client xxxxxxx:49231] PHP Fatal error: Class 'Cpdf' not found in /usr/share/zabbix/inc/class.ezpdf.php on line 5, referer: http://xxxxx/zabbix/chooser.php
                          [Tue Aug 20 06:28:45.116471 2019] [mpm_prefork:notice] [pid 6176] AH00170: caught SIGWINCH, shutting down gracefully
                          [Tue Aug 20 06:28:53.199666 2019] [suexec:notice] [pid 24678] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
                          [Tue Aug 20 06:28:53.221994 2019] [auth_digest:notice] [pid 24678] AH01757: generating secret for digest authentication ...
                          [Tue Aug 20 06:28:53.222596 2019] [lbmethod_heartbeat:notice] [pid 24678] AH02282: No slotmem from mod_heartmonitor
                          [Tue Aug 20 06:28:53.250996 2019] [mpm_prefork:notice] [pid 24678] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
                          [Tue Aug 20 06:28:53.251024 2019] [core:notice] [pid 24678] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
                          [Tue Aug 20 06:29:54.270932 2019] [:error] [pid 24697] [client xxxxxxx:56036] PHP Fatal error: Class 'Cpdf' not found in /usr/share/zabbix/inc/class.ezpdf.php on line 5, referer: http://xxxxxx/zabbix/chooser.php
                          [Tue Aug 20 06:53:26.261478 2019] [:error] [pid 24696] [client xxxxxxx:57270] PHP Fatal error: Class 'Cpdf' not found in /usr/share/zabbix/inc/class.ezpdf.php on line 5
                          [Tue Aug 20 09:21:41.454293 2019] [:error] [pid 24681] [client 10.45.236.233:51513] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Tue Aug 20 09:21:53.289575 2019] [:error] [pid 27561] [client 10.45.236.233:51536] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Tue Aug 20 09:22:03.104500 2019] [:error] [pid 24684] [client 10.45.236.233:51533] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Tue Aug 20 09:23:27.588519 2019] [:error] [pid 24685] [client 10.45.236.233:51649] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Tue Aug 20 09:51:11.388262 2019] [:error] [pid 24696] [client xxxxxxx:63364] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Wed Aug 21 01:56:27.144125 2019] [:error] [pid 4191] [client xxxxxxx:53405] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Wed Aug 21 01:56:49.674848 2019] [:error] [pid 24697] [client xxxxxxx:53428] PHP Fatal error: Class 'Cpdf' not found in /usr/share/zabbix/inc/class.ezpdf.php on line 5, referer: http://xxxxxxx/zabbix/chooser.php
                          [Wed Aug 21 04:49:00.210893 2019] [:error] [pid 24684] [client xxxxxxx:49327] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Wed Aug 21 08:49:32.638819 2019] [:error] [pid 24697] [client xxxxxxx:53364] PHP Warning: Creating default object from empty value in /usr/share/zabbix/inc/ZabbixAPI.class.php on line 122
                          [Wed Aug 21 08:49:47.115782 2019] [:error] [pid 26785] [client xxxxxxx:53399] PHP Fatal error: Class 'Cpdf' not found in /usr/share/zabbix/inc/class.ezpdf.php on line 5, referer: http://xxxxxxx/zabbix/chooser.php

                          Comment

                          • afjunior
                            Junior Member
                            • May 2013
                            • 8

                            #388

                            Hello. This project is really fantastic, congratulations! Is there any forecast for it to work with newer versions of php? 7.2 for example. Thanks


                            Comment

                            • KINGAB_93
                              Junior Member
                              • Oct 2019
                              • 3

                              #389
                              hi all , . I have installed Zabbix 4.2 recently on ubuntu 18.04 and it is running fine. I wanted to generate zabbix report in PDF and came across this link " https://github.com/martinm76/zabbix-pdf-report " and this "https://github.com/catonrug/zabbix-pdf-report". I downloaded and configured based on the instructions in those link. But still I'm not able to launch report UI.It says 404 not found.

                              any help please?

                              Comment

                              • Pragathi
                                Junior Member
                                • May 2019
                                • 7

                                #390
                                I'm trying to generate pdf reports, everything works fine but PDF not generating, When I select a host and Range=Days and check the Debug button and click on "Generate", I get the following code as the output.

                                Notice: tempnam(): file created in the system's temporary directory in /usr/share/zabbix/reports/inc/createpdf.functions.php on line 22

                                Notice: tempnam(): file created in the system's temporary directory in /usr/share/zabbix/reports/createpdf.php on line 128
                                HostID: 10263
                                GroupID:
                                Report Type: host
                                Time Period: 86400
                                Temp image path: /tmp/zabbix_report_cxRIP8


                                Warning: get_class() expects parameter 1 to be object, null given in /usr/share/zabbix/reports/inc/ZabbixAPI.class.php on line 207
                                Time scope - starttime: 1571295976, endtime: 1571382376 - stime: 20191017123616

                                Airtel(id:10263)


                                Graph selector : #(Ping|CPU load|CPU usage|CPU util|processor|Disk space|Swap|Ethernet|Memory usage|^Traffic on |traffic on eth)#

                                Interface eth0: Network traffic (id:814) did not match the expression - skipping it.
                                Interface nas0: Network traffic (id:815) did not match the expression - skipping it.
                                Interface lan: Network traffic (id:816) did not match the expression - skipping it.
                                ./images/general/logo.png written to PDF-file ...
                                Report ready - available as: ./reports/Airtel.pdf


                                Then Once I click on the Report, I get error saying that URL not found, hence PDF is not generating.

                                I'm using this for zabbix 4.2 version,
                                PDF report version is : Version: 1.1.1


                                Thanks for the Help!!!!

                                Comment


                                • KINGAB_93
                                  KINGAB_93 commented
                                  Editing a comment
                                  can you please tell me how did you manage to get even the Page ?
                                  personaly I try evrerything but am not able using http://my_Ip/zbxreport/
                                  I'm using zabbix 4.0
                              Working...