Ad Widget

Collapse

Zabbix Dynamic PDF Report Generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • for
    Junior Member
    • Aug 2015
    • 2

    #286
    bug?

    hi martinm_76 good job

    I have this log message:

    Code:
    PHP Warning:  Creating default object from empty value in /usr/share/zabbix/plugin/zabbix_report_generation/inc/ZabbixAPI.class.php on line 122, referer: http://192.168.10.58/zabbix/plugin/zabbix_report_generation/index.php
    PHP Fatal error:  Call to undefined function curl_init() in /usr/share/zabbix/plugin/zabbix_report_generation/inc/ZabbixAPI.class.php on line 322, referer: http://192.168.10.58/zabbix/plugin/zabbix_report_generation/index.php
    My configinc.php:

    Code:
    $user_login=1; // If $user_login is 0, use credentials below and don't prompt for login.
    # zabbix server info(user must have API access)
    $z_server       = 'http://192.168.10.58/zabbix/';
    $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	= "/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	= 'Europe/Oslo';
    # Logo used in PDF - may be empty
    # TODO: Specify image size!
    $pdf_logo	= './images/general/zabbix.png';
    $company_name   = 'zabbix';
    zabbix:2.4
    Cetnos6
    zabbix-pdf-report-09

    Can u help me pls?
    Thx.

    Comment

    • martinm_76
      Member
      • Mar 2015
      • 57

      #287
      Originally posted by for
      hi martinm_76 good job

      I have this log message:

      Code:
      PHP Warning:  Creating default object from empty value in /usr/share/zabbix/plugin/zabbix_report_generation/inc/ZabbixAPI.class.php on line 122, referer: http://192.168.10.58/zabbix/plugin/zabbix_report_generation/index.php
      PHP Fatal error:  Call to undefined function curl_init() in /usr/share/zabbix/plugin/zabbix_report_generation/inc/ZabbixAPI.class.php on line 322, referer: http://192.168.10.58/zabbix/plugin/zabbix_report_generation/index.php
      - snip -

      zabbix:2.4
      Cetnos6
      zabbix-pdf-report-09

      Can u help me pls?
      Thx.
      Can you verify that Curl support is available in your PHP installation?
      Either make e.g. an info.php with this content:

      <?php

      phpinfo();

      ?>

      Or run 'php -i' and look for Curl. If no mention of Curl is found, you need to install the PHP module that gives you Curl support.

      Comment

      • for
        Junior Member
        • Aug 2015
        • 2

        #288
        Originally posted by martinm_76
        Can you verify that Curl support is available in your PHP installation?
        Either make e.g. an info.php with this content:

        <?php

        phpinfo();

        ?>

        Or run 'php -i' and look for Curl. If no mention of Curl is found, you need to install the PHP module that gives you Curl support.
        Thank you , I changed vm and I missed this module.
        Sorry for the inconvenience and again good job.

        Comment

        • Eudemonia
          Junior Member
          • Mar 2015
          • 4

          #289
          Sorry for the old bump, but I'm having trouble getting this plugin working. I'm running Zabbix server v2.2.2, and it's generating pdfs but without graphs. Instead of graphs I get:

          ERROR: No permissions to referred object or it does not exist!

          I know someone posted about this issue before, but its resolution didn't seem totally explained. This could very well be a different issue anyway, so let me know what logs/config files to post for analysis.
          Last edited by Eudemonia; 30-09-2015, 00:00.

          Comment

          • martinm_76
            Member
            • Mar 2015
            • 57

            #290
            Originally posted by Eudemonia
            Sorry for the old bump, but I'm having trouble getting this plugin working. I'm running Zabbix server v2.2.2, and it's generating pdfs but without graphs. Instead of graphs I get:

            ERROR: No permissions to referred object or it does not exist!

            I know someone posted about this issue before, but its resolution didn't seem totally explained. This could very well be a different issue anyway, so let me know what logs/config files to post for analysis.
            Hey. It sounds like you have insufficient rights on the temporary directory, but are able to write to the reports directory.

            Please try this:
            • Look up $z_tmp_path and $pdf_report_dir in config.inc.php
            • Do a 'chmod 777' on the temp directory, and possibly the reports one, too.
            • Try generating a new report with graphs.

            Comment

            • Eudemonia
              Junior Member
              • Mar 2015
              • 4

              #291
              Originally posted by martinm_76
              Hey. It sounds like you have insufficient rights on the temporary directory, but are able to write to the reports directory.

              Please try this:
              • Look up $z_tmp_path and $pdf_report_dir in config.inc.php
              • Do a 'chmod 777' on the temp directory, and possibly the reports one, too.
              • Try generating a new report with graphs.
              This is what I assumed too. I already granted 777 to both my temp + reports directory, but the issue still persists.

              Comment

              • coreychristian
                Senior Member
                Zabbix Certified Specialist
                • Jun 2012
                • 159

                #292
                Hey All,

                Just wondering, is there a way to limit which graphs get populated in the pdf file? For example we have one database server that houses transaction metrics for multiple clients. Ideally I would like to generate a pdf for an individual client's metrics and not the others.

                Sorry if this has been asked before, I tried digging through the thread but it's possible I missed it.

                Comment

                • martinm_76
                  Member
                  • Mar 2015
                  • 57

                  #293
                  Originally posted by Eudemonia
                  This is what I assumed too. I already granted 777 to both my temp + reports directory, but the issue still persists.
                  Check if your selinux status matches this:

                  # sestatus
                  SELinux status: enabled
                  SELinuxfs mount: /selinux
                  Current mode: permissive
                  Mode from config file: permissive

                  If it is 'enforcing' you either have to configure a lot of things or change it to permissive.

                  Usually you can set this in /etc/selinux/config

                  Comment

                  • martinm_76
                    Member
                    • Mar 2015
                    • 57

                    #294
                    Originally posted by coreychristian
                    Hey All,

                    Just wondering, is there a way to limit which graphs get populated in the pdf file? For example we have one database server that houses transaction metrics for multiple clients. Ideally I would like to generate a pdf for an individual client's metrics and not the others.

                    Sorry if this has been asked before, I tried digging through the thread but it's possible I missed it.
                    Well, it's possible, but it is not currently implemented. Patches welcome
                    It is a non-trivial thing to implement, but I suppose the most likely way of doing it would be to iterate the possible graphs and let the user choose which they want to include in the final report. Most likely this would require either one more redirect or some serious AJAX that I don't presently possess the skills to implement.

                    If someone out there has the itch to implement this to a greater degree than me and are able to, please do. I may take a look at it 'soonish', but I have a lot of other tasks I need to get done first, I'm afraid.

                    Comment

                    • coreychristian
                      Senior Member
                      Zabbix Certified Specialist
                      • Jun 2012
                      • 159

                      #295
                      Originally posted by martinm_76
                      Well, it's possible, but it is not currently implemented. Patches welcome
                      It is a non-trivial thing to implement, but I suppose the most likely way of doing it would be to iterate the possible graphs and let the user choose which they want to include in the final report. Most likely this would require either one more redirect or some serious AJAX that I don't presently possess the skills to implement.

                      If someone out there has the itch to implement this to a greater degree than me and are able to, please do. I may take a look at it 'soonish', but I have a lot of other tasks I need to get done first, I'm afraid.
                      No problem, I was hoping maybe I was missing something easy as I just implemented it in our dev environment yesterday. A work around I was thinking about doing was just making a ghost host(not ideal) with the graphs I want, I would love to help on implementing but it is pretty far beyond my skills as well.

                      Comment

                      • sancho
                        Senior Member
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • Mar 2015
                        • 295

                        #296
                        google
                        Hi all,
                        First, sorry for my English.
                        I am trying to create pdf reports with version 0.9.
                        Zabbix version is:
                        Zabbix server v2.4.7 (revision 56694) (12 November 2015)
                        Ubuntu 15.10

                        And my setup:
                        Code:
                        <?php
                        //CONFIGURABLE
                        //$user_login=1; // If $user_login is 0, use credentials below and don't prompt for login.
                        $user_login=0; // If $user_login is 0, use credentials below and don't prompt for login.
                        $allow_localhost=1; // If a request is made from 127.0.0.1, use credentials below in createpdf.php
                        
                        $version	= '0.9';
                        
                        // What items would you like to see in the report? Things that do not match are excluded automatically.
                        $items = array('system information'=>'string','uptime'=>'seconds', 'boot time'=>'datetime', 'available memory'=>'number', 'version of zabbix_agent'=>'string', 'services'=>'string', 'update'=>'number','certificate'=>'string','advanced ntp'=>'string');
                        
                        # zabbix server info(user must have API access)
                        $z_server       = 'http://10.232.98.110/zabbix/';
                        $z_user		= 'admin';
                        $z_pass         = 'zabbix';
                        # Temporary directory for storing pdf data and graphs - must exist
                        $z_tmp_path	= '/usr/share/zabbix/zabbix-dynamic-pdf-report/tmp';
                        # Directory for storing PDF reports
                        $pdf_report_dir	= '/usr/share/zabbix/zabbix-dynamic-pdf-report/report';
                        # Root URL to reports
                        #$pdf_report_url	= $z_server ."report/reports";
                        $pdf_report_url	= "http://10.232.98.110/zabbix/zabbix-dynamic-pdf-report/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	= 'Europe/Oslo';
                        # Logo used in PDF - may be empty
                        # TODO: Specify image size!
                        $pdf_logo	= './images/general/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";
                        ?>
                        When I requested the report dle zabbix server for example, creates pdf graphics but shows me, only it shows the error I attached.

                        The folders have the correct permissions to www-data, I not think I can be doing wrong.

                        The apache log shows the following

                        Code:
                        [Tue Dec 15 20:26:02.684761 2015] [:error] [pid 1521] [client 10.232.1.17:19277] PHP Warning:  Creating default object from empty value in /usr/share/zabbix/zabbix-dynamic-pdf-report/inc/ZabbixAPI.class.php on line 122, referer: http://10.232.98.110/zabbix/zabbix-dynamic-pdf-report/chooser.php
                        Excuse me, but although I have seen that they have already discussed this error, I have found the solution.

                        Thanks for your help
                        Last edited by sancho; 10-08-2016, 21:23.

                        Comment

                        • sancho
                          Senior Member
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Mar 2015
                          • 295

                          #297
                          Hi,
                          Nobody knows what you may be doing wrong ??

                          The permissions are correct and mi selinux:

                          SELinux status: enabled
                          SELinuxfs mount: /sys/fs/selinux
                          SELinux root directory: /etc/selinux
                          Loaded policy name: ubuntu
                          Current mode: permissive
                          Mode from config file: permissive
                          Policy MLS status: enabled
                          Policy deny_unknown status: allowed
                          Max kernel policy version: 29
                          Last edited by sancho; 21-12-2015, 09:47.

                          Comment

                          • sat_cse28
                            Junior Member
                            • Dec 2015
                            • 2

                            #298
                            Warning messages

                            Thanks for the script, its working fine.But while I browse that page seeing the below warning messages. Can you help me on this.Thanks.


                            [Tue Dec 22 09:33:00.242733 2015] [:error] [pid 20226] [client:56309] PHP Warning: Creating default object from empty value in /usr/share/zabbix/generate/inc/ZabbixAPI.class.php on line 122, referer: http://ip/zabbix/generate/
                            [Tue Dec 22 09:33:18.995871 2015] [:error] [pid 21114] [client :56352] PHP Warning: Creating default object from empty value in /usr/share/zabbix/generate/inc/ZabbixAPI.class.php on line 122, referer: http://ip/zabbix/generate/chooser.php

                            Comment

                            • stanito
                              Junior Member
                              • Mar 2016
                              • 3

                              #299
                              Is the development of this plugin is still alive? Is there any Git repository for the latest version???

                              Is it possible to generate not only graphs of the host, but also a screens? I need to have a report with some "text" metrics, that can't be made by graph...

                              Comment

                              • suxxoi
                                Junior Member
                                • Mar 2016
                                • 14

                                #300
                                Originally posted by Axilla
                                v0.1 Beta
                                # - Generate dynamic PDF report from custom graphs
                                # - All Hosts or Single Host
                                # - Timeperiods of Hour, Day, Week, Month, Year

                                v0.2 Beta
                                Change Log:
                                # - moved all configuration to a single file.. configuration is now done in config.inc.php
                                # - removed all MySQL specific calls and replaced with API calls. Now anyone should be able to use the addon who is running 1.8 API.

                                v0.3 Beta
                                Change Log:
                                # - fixed an issue where hosts with no graphs were showing up in selection form
                                # - added timezone to configuration file
                                # - added paper size to configuration file
                                # - added paper orientation to configuration file
                                # - fixed an alignment issue where graphs were covering up the header

                                The idea behind this addon is that it will be version independent. This is a screen embeded custom page. NO PATCHING REQUIRED, but still allows you to use it inside the zabbix UI.

                                This was originally created for self use, but I know it is a much requested feature so, please help test and fix problems

                                How To:

                                1. unzip file to your zabbix directory(I like to create a custom_pages directory and place them all there)
                                2. configure config.inc.php with your zabbix server information
                                3. make data.txt and your tmp_images directory readable and writeable by apache user
                                4. Login to zabbix and create a new 1 row 1 column screen with a URL width and height of 800x600 / Centre / Top
                                5. add URL to pdfform.php to new screen.
                                6. in php.ini set display_error = OFF
                                7. restart apache

                                Development is ongoing please post problems and ideas here.

                                Known Problems:

                                # Tested on Zabbix 1.8.8 and 1.8.10 but should work with any 1.8 API and Zabbix.

                                Download Link: http://www.zabbix.org/mw/images/e/e9...generation.zip
                                Example Report: http://www.zabbix.org/mw/images/8/8f...generation.pdf

                                required:
                                php-curl
                                php-json
                                Hello, thank you for the script!!
                                How to upload some graphics, but not all.
                                I need to in the report were charts with the names of CPU load, Memory usag ....

                                Comment

                                Working...