Ad Widget

Collapse

Zabbix Dynamic PDF Report Generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • martinm_76
    Member
    • Mar 2015
    • 57

    #256
    Originally posted by pantera
    $z_server = 'http://10.x.x.230/zabbix';
    $z_user = 'zabbix';
    $z_pass = 'zabbix';


    I use uWamp on windows

    can not login
    Two things: Remember ending slash in URL: 'http://10.x.x.230/zabbix/';
    $z_user would normally be 'admin'. Are you sure you have a 'zabbix' user?

    Comment

    • execve
      Junior Member
      • May 2015
      • 1

      #257
      Hello Martin,

      I have problem with displaying trigger/acknowledgement information in my Report. My custom graphs and items works fine.
      When I look into Apache logs, I see:
      Code:
      [Fri May 08 22:16:38 2015] [error] [client IP.IP.IP.IP] PHP Warning:  Creating default object from empty value in /usr/share/zabbix/report/inc/ZabbixAPI.class.php on line 122, referer: http://domain.com/zabbix/report/chooser.php
      [Fri May 08 22:16:39 2015] [error] [client IP.IP.IP.IP] PHP Warning:  fwrite(): 21 is not a valid stream resource in /usr/share/zabbix/report/inc/createpdf.functions.php on line 170, referer: http://domain.com/zabbix/report/chooser.php
      [Fri May 08 22:16:39 2015] [error] [client IP.IP.IP.IP] PHP Warning:  fwrite(): 21 is not a valid stream resource in /usr/share/zabbix/report/inc/createpdf.functions.php on line 173, referer: http://domain.com/zabbix/report/chooser.php
      [Fri May 08 22:16:39 2015] [error] [client IP.IP.IP.IP] PHP Warning:  fclose(): 21 is not a valid stream resource in /usr/share/zabbix/report/inc/createpdf.functions.php on line 174, referer: http://domain.com/zabbix/report/chooser.php
      My:
      Zabbix server ver. 2.2.9
      OS: CentOS 6

      Comment

      • pantera
        Member
        • Dec 2014
        • 39

        #258
        Originally posted by martinm_76
        Two things: Remember ending slash in URL: 'http://10.x.x.230/zabbix/';
        $z_user would normally be 'admin'. Are you sure you have a 'zabbix' user?
        result: for zabbix user
        Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Incorrect method "user.authenticate". )

        I changed the name to frontend login user
        result : empty page
        Last edited by pantera; 11-05-2015, 10:41.

        Comment

        • taken
          Junior Member
          • May 2015
          • 15

          #259
          Host grp generate only 1 host

          hello Guys,
          I got strange problem with Zabbix PDF report Generator.
          When i go to https://xxx.pl/zabbix/report/ login to my Zabbix account and choice Host Group, Select DNS servers host group, Report range last week, he generate only 1 DNS server report... but in this host grp there is 7 hosts... he only generate report for 1 server in host grp.

          This is report what he generate:
          XXXX

          Another problem:
          I saw problem with text in red background if name of Company is big he don`t wordwraps - he cut letters.

          Thanks
          TaKeN
          Last edited by taken; 24-06-2020, 19:23.

          Comment

          • vlam
            Senior Member
            Zabbix Certified Specialist
            • Jun 2009
            • 166

            #260
            Hi Guys

            When going to URL https://x.x.x.x/zabbix/report/ i get the following screen and am not sure on how to fix it (See Attachment). Can someone please tell me what I am doing wrong?

            My Config is as follow:

            <?php
            //CONFIGURABLE
            # zabbix server info(user must have API access)
            $z_server = 'https://x.x.x.x/zabbix/';
            $z_user = 'Admin';
            $z_pass = 'Sup3rS3cur3';
            # 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";
            # 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 = 'Africa/Johannesburg';
            # Logo used in PDF - may be empty
            # TODO: Specify image size!
            $pdf_logo = './images/zabbix.png';
            $company_name = 'Business Connexion';

            //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";
            ?>
            Attached Files
            4 Zabbix Frontend Servers (Load balanced)
            2 Zabbix App Servers (HA)
            2 Zabbix Database Servers (HA)
            18 Zabbix Proxy Servers (HA)
            3897 Deployed Zabbix Agents
            6161 Values per second
            X-Layer Integration
            Jaspersoft report Servers (HA)

            Comment

            • vlam
              Senior Member
              Zabbix Certified Specialist
              • Jun 2009
              • 166

              #261
              Originally posted by vlam
              Hi Guys

              When going to URL https://x.x.x.x/zabbix/report/ i get the following screen and am not sure on how to fix it (See Attachment). Can someone please tell me what I am doing wrong?

              My Config is as follow:

              <?php
              //CONFIGURABLE
              # zabbix server info(user must have API access)
              $z_server = 'https://x.x.x.x/zabbix/';
              $z_user = 'Admin';
              $z_pass = 'Sup3rS3cur3';
              # 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";
              # 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 = 'Africa/Johannesburg';
              # Logo used in PDF - may be empty
              # TODO: Specify image size!
              $pdf_logo = './images/zabbix.png';
              $company_name = 'Business Connexion';

              //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";
              ?>


              I found an earlier post where someone said to change the /inc/ZabbixAPI.class.php file line where it states user.Authenticate to user.login which I did and now I get the following error. (Strangely I can login on the frontend with the user)
              Attached Files
              4 Zabbix Frontend Servers (Load balanced)
              2 Zabbix App Servers (HA)
              2 Zabbix Database Servers (HA)
              18 Zabbix Proxy Servers (HA)
              3897 Deployed Zabbix Agents
              6161 Values per second
              X-Layer Integration
              Jaspersoft report Servers (HA)

              Comment

              • vlam
                Senior Member
                Zabbix Certified Specialist
                • Jun 2009
                • 166

                #262
                Update on my Previous problem, I have solved it by replacing the version of PDF report with the latest 0.9 version from martinm and now I get past the login and also gets to the part where it asks for the server selection and generate of report. My current problem that I am getting is it comes back with

                The requested URL /report/reports/Server_Name.pdf was not found on this server.

                What can this be and how do I fix it?

                Thanks
                4 Zabbix Frontend Servers (Load balanced)
                2 Zabbix App Servers (HA)
                2 Zabbix Database Servers (HA)
                18 Zabbix Proxy Servers (HA)
                3897 Deployed Zabbix Agents
                6161 Values per second
                X-Layer Integration
                Jaspersoft report Servers (HA)

                Comment

                • martinm_76
                  Member
                  • Mar 2015
                  • 57

                  #263
                  Originally posted by vlam
                  Update on my Previous problem, I have solved it by replacing the version of PDF report with the latest 0.9 version from martinm and now I get past the login and also gets to the part where it asks for the server selection and generate of report. My current problem that I am getting is it comes back with

                  The requested URL /report/reports/Server_Name.pdf was not found on this server.

                  What can this be and how do I fix it?

                  Thanks
                  Most likely, your rights are incorrect on tmp and/or reports.
                  They need to either be 777 or owned by the webserver user.

                  chmod 777 tmp reports

                  It *should* already be set, but it seems many people do not get this result when they unpack the archive ...

                  Comment

                  • martinm_76
                    Member
                    • Mar 2015
                    • 57

                    #264
                    Originally posted by execve
                    Hello Martin,

                    I have problem with displaying trigger/acknowledgement information in my Report. My custom graphs and items works fine.
                    When I look into Apache logs, I see:
                    Code:
                    [Fri May 08 22:16:38 2015] [error] [client IP.IP.IP.IP] PHP Warning:  Creating default object from empty value in /usr/share/zabbix/report/inc/ZabbixAPI.class.php on line 122, referer: http://domain.com/zabbix/report/chooser.php
                    [Fri May 08 22:16:39 2015] [error] [client IP.IP.IP.IP] PHP Warning:  fwrite(): 21 is not a valid stream resource in /usr/share/zabbix/report/inc/createpdf.functions.php on line 170, referer: http://domain.com/zabbix/report/chooser.php
                    [Fri May 08 22:16:39 2015] [error] [client IP.IP.IP.IP] PHP Warning:  fwrite(): 21 is not a valid stream resource in /usr/share/zabbix/report/inc/createpdf.functions.php on line 173, referer: http://domain.com/zabbix/report/chooser.php
                    [Fri May 08 22:16:39 2015] [error] [client IP.IP.IP.IP] PHP Warning:  fclose(): 21 is not a valid stream resource in /usr/share/zabbix/report/inc/createpdf.functions.php on line 174, referer: http://domain.com/zabbix/report/chooser.php
                    My:
                    Zabbix server ver. 2.2.9
                    OS: CentOS 6
                    Hmm .. I know there are a few cases where these fwrite and fclose show up. I have not spent time debugging them since I get the expected data in my reports. It you select debug and have triggers selected, do you get a dump of them on your screen?

                    As always, I have developed these latest iterations on Zabbix 2.4 and I haven't tested it on anything else.

                    Comment

                    • martinm_76
                      Member
                      • Mar 2015
                      • 57

                      #265
                      Originally posted by taken
                      hello Guys,
                      I got strange problem with Zabbix PDF report Generator.
                      When i go to https://xxx.pl/zabbix/report/ login to my Zabbix account and choice Host Group, Select DNS servers host group, Report range last week, he generate only 1 DNS server report... but in this host grp there is 7 hosts... he only generate report for 1 server in host grp.

                      This is report what he generate:


                      Another problem:
                      I saw problem with text in red background if name of Company is big he don`t wordwraps - he cut letters.

                      Thanks
                      TaKeN
                      I believe this was one of the things I fixed in 0.9. Could you please use that in stead of 0.8?

                      Comment

                      • taken
                        Junior Member
                        • May 2015
                        • 15

                        #266
                        Originally posted by martinm_76
                        I believe this was one of the things I fixed in 0.9. Could you please use that in stead of 0.8?
                        Hey You got right but still problem with cut Company name exist in 0.9.

                        Thanks

                        Comment

                        • vlam
                          Senior Member
                          Zabbix Certified Specialist
                          • Jun 2009
                          • 166

                          #267
                          Originally posted by martinm_76
                          Most likely, your rights are incorrect on tmp and/or reports.
                          They need to either be 777 or owned by the webserver user.

                          chmod 777 tmp reports

                          It *should* already be set, but it seems many people do not get this result when they unpack the archive ...


                          Hi Martin

                          Thanks for the help, I got it working so now it is just to give it a look and feel of our company sites

                          Thanks
                          4 Zabbix Frontend Servers (Load balanced)
                          2 Zabbix App Servers (HA)
                          2 Zabbix Database Servers (HA)
                          18 Zabbix Proxy Servers (HA)
                          3897 Deployed Zabbix Agents
                          6161 Values per second
                          X-Layer Integration
                          Jaspersoft report Servers (HA)

                          Comment

                          • vlam
                            Senior Member
                            Zabbix Certified Specialist
                            • Jun 2009
                            • 166

                            #268
                            Hi Martin

                            First off my programming skills is horrible and to see something like this that you have created is great. I would however like to find out from you if it would be possible to have a section list of the graphs and triggers for when you select the host. An example requirement that was given to me is as follow: We are monitoring shared FortiGate devices that is shared between multiple client but when a specific client requires a report of his Firewall status then you don't want to pull a report of everything. Same when a client is doing a server performance test for an DB or application then you done need uptime and Disk usage stats.

                            Would it be possible to create and add-on that can have a server graph/monitored metric selection box?

                            Thanks
                            4 Zabbix Frontend Servers (Load balanced)
                            2 Zabbix App Servers (HA)
                            2 Zabbix Database Servers (HA)
                            18 Zabbix Proxy Servers (HA)
                            3897 Deployed Zabbix Agents
                            6161 Values per second
                            X-Layer Integration
                            Jaspersoft report Servers (HA)

                            Comment

                            • martinm_76
                              Member
                              • Mar 2015
                              • 57

                              #269
                              Originally posted by vlam
                              Hi Martin

                              First off my programming skills is horrible and to see something like this that you have created is great. I would however like to find out from you if it would be possible to have a section list of the graphs and triggers for when you select the host. An example requirement that was given to me is as follow: We are monitoring shared FortiGate devices that is shared between multiple client but when a specific client requires a report of his Firewall status then you don't want to pull a report of everything. Same when a client is doing a server performance test for an DB or application then you done need uptime and Disk usage stats.

                              Would it be possible to create and add-on that can have a server graph/monitored metric selection box?

                              Thanks
                              Well, it would take some doing, but I suppose you could have one more page before the actual graphing where you could return the list of graphs and such for individual selection. It it not easily accomplished with triggers, though, as there can be many for any item, but I suppose you could have an intermediate step of selecting which items you want triggers for. It could be a veeeery long list, though, and probably only feasible with one host selected in stead of a host group.

                              I am not sure when I would get around to do that, but it is an interesting idea.

                              Perhaps the originators of the versions I based 0.8 onwards on, Travis Mathis and Ronny Pettersen, could be interested in tackling this?
                              Someone else? If not, I may get around to it within a month or two, as I think it is a good idea, but implementation will require a fair bit of thought and man hours, and I have to prioritize paying engagements.

                              Comment

                              • waardd
                                Member
                                • Aug 2014
                                • 82

                                #270
                                Originally posted by martinm_76
                                Image doesn't show for me.
                                What browsers have you tried (and what versions)? Is the result identical in all of them?
                                Have you cleared your cache/Run the report on a machine you have never tried it on with the same result?
                                Is there a proxy between you and the server?

                                I had an issue with not seeing the contents of the dropdowns at one point, but I think I got it sorted by making sure I was completely logged out (which may be slightly problematic for you, since it seems the logout function is not playing ball) and making sure I cleared all cookies for the given page.

                                Try with pure IP URL and with FQDN URL (e.g. zabbix.yourcompany.com/report/).

                                It may also be your php.ini file that is blocking functionality that is needed. Have the default php.ini been modified in any way?

                                There are probably more things that could be the cause, but those are what springs to mind. That and it works fine on my CentOS 6.6 64-bit.

                                Check if your values resemble this in php.ini:
                                Code:
                                [PHP]
                                engine = On
                                short_open_tag = Off
                                asp_tags = Off
                                precision = 14
                                y2k_compliance = On
                                output_buffering = 4096
                                zlib.output_compression = Off
                                implicit_flush = Off
                                unserialize_callback_func =
                                serialize_precision = 100
                                allow_call_time_pass_reference = Off
                                safe_mode = Off
                                safe_mode_gid = Off
                                safe_mode_include_dir =
                                safe_mode_exec_dir =
                                safe_mode_allowed_env_vars = PHP_
                                safe_mode_protected_env_vars = LD_LIBRARY_PATH
                                disable_functions =
                                disable_classes =
                                expose_php = On
                                max_execution_time = 30     
                                max_input_time = 60
                                memory_limit = 128M
                                error_reporting = E_ALL & ~E_DEPRECATED
                                display_errors = Off
                                display_startup_errors = Off
                                log_errors = On
                                log_errors_max_len = 1024
                                ignore_repeated_errors = Off
                                ignore_repeated_source = Off
                                report_memleaks = On
                                track_errors = Off
                                html_errors = Off
                                variables_order = "GPCS"
                                request_order = "GP"
                                register_globals = Off
                                register_long_arrays = Off
                                register_argc_argv = Off
                                auto_globals_jit = On
                                post_max_size = 8M
                                magic_quotes_gpc = Off
                                magic_quotes_runtime = Off
                                magic_quotes_sybase = Off
                                auto_prepend_file =
                                auto_append_file =
                                default_mimetype = "text/html"
                                doc_root =
                                user_dir =
                                enable_dl = Off
                                file_uploads = On
                                upload_max_filesize = 2M
                                allow_url_fopen = On
                                allow_url_include = Off
                                default_socket_timeout = 60
                                [Date]
                                date.timezone='Europe/Berlin';
                                More besides, but those parts ought to be the important bits.
                                My PHP has the same values (except for up and download size, its higher then yours.
                                I tried the direct URL and got the same result on multiple browsers.

                                =====
                                HostID: 10348
                                Report Type: host
                                Time Period: 3600
                                Temp image path: /appl/mcv/html/zabbix/frontends/php/report/tmp/zabbix_report_u5HpkO

                                (id
                                jk-8009 worker threads(id:372)
                                http-8080 worker threads(id:373)
                                http-8443 worker threads(id:374)
                                sessions /(id:375)
                                3150-cpu(id:387)
                                3150-load(id:391)
                                3148-cpu(id:392)
                                3148-load(id:393)
                                Space in Queue(id:437)
                                Space in Queue(id:438)
                                Space in Queue(id:439)
                                and so on
                                =====

                                The selection list for Hosts is filled but with blanks.
                                The selectioon list for HostGroups is filled and readable but has the same effect when creating a report:

                                ====
                                GroupID: 53
                                Report Type: hostgroup
                                Time Period: 3600
                                Temp image path: /appl/mcv/html/zabbix/frontends/php/report/tmp/zabbix_report_qqbyT7

                                (id
                                jk-8009 worker threads(id:372)
                                http-8080 worker threads(id:373)
                                http-8443 worker threads(id:374)
                                sessions /(id:375)
                                3150-cpu(id:387)
                                3150-load(id:391)
                                3148-cpu(id:392)
                                3148-load(id:393)
                                Space in Queue(id:437)
                                Space in Queue(id:438)
                                Space in Queue(id:439)
                                MySQL Threads(id:470)
                                MySQL Questions(id:471)
                                MySQL slow queries(id:472)
                                and so on
                                ====

                                Comment

                                Working...