Announcement

Collapse
No announcement yet.

Zabbix Dynamic PDF Report Generation

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Zabbix Dynamic PDF Report Generation

    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
    Last edited by Axilla; 09-02-2012, 16:32.

    #2
    no longer required.. removed by Axilla.
    Last edited by Axilla; 08-02-2012, 17:08.

    Comment


      #3
      I got this error:

      Code:
      Fatal error: Call to undefined function curl_init() in /var/www/ZabbixAPI.class.php on line 287
      Should i do something in "ZabbixAPI.class.php"?, because i realize the url variable is empty but i don't now if i need to configure something else.

      Thanks!

      Comment


        #4
        you shouldn't need to change anything in ZabbixAPI.class.php

        in generatereport.php look at the $z_server

        you probably have https:// -- in my environment i use secure HTTP you probably just need to change that to http://

        Comment


          #5
          v0.1.1 beta uploaded.

          Change Log:
          - changed https to http in config areas
          - fixed incorrect redirect after pdf is generated.

          http://www.zabbix.org/mw/images/e/e9...generation.zip
          Last edited by Axilla; 07-02-2012, 20:58.

          Comment


            #6
            Note: Make sure that in /etc/php.ini you have display_error = Off

            and then restart apache... this will cause problem when generating the PDF if it is On.

            Comment


              #7
              v0.2 Beta - 2/7/2012

              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.

              Download Link: http://www.zabbix.org/mw/images/e/e9...generation.zip

              Comment


                #8
                In 0.2 I noticed its a little confusing in the config.inc.php to what pdf_location is.. it should be the tail of the url NOT a absolute path.

                Example
                z_server = "http://www.mynetworkmonitoring.com/zabbix/

                pdf_location = "custom_pages/pdf.php"

                together they make http://www.mynetworkmonitoring.com/z..._pages/pdf.php

                Comment


                  #9
                  Thanks for the bug reports/suggestions so far, you can post them here,PM them to me, or find me on #zabbix! keep em coming and i'll keep improving!

                  Comment


                    #10
                    v0.3 released see original post for change log

                    Comment


                      #11
                      Almost there....
                      It would be very appreciated if you could list the requirements in order to use this add-on. For example i notice it uses curl and perl. But i don't know if that's all. So far (for me) only shows a bunch of code when i click generate. I'm going to keep trying in order to see whats wrong or if i need something else. Thanks.

                      Comment


                        #12
                        Originally posted by efrain02 View Post
                        Almost there....
                        It would be very appreciated if you could list the requirements in order to use this add-on. For example i notice it uses curl and perl. But i don't know if that's all. So far (for me) only shows a bunch of code when i click generate. I'm going to keep trying in order to see whats wrong or if i need something else. Thanks.

                        if you're seeing a bunch of random letters and things when generating set display_error = off in php.ini and restart apache.. that should clear it up.

                        Comment


                          #13
                          I already do that. Let me try and i would let you know how is it going.

                          Comment


                            #14
                            please do , the more people testing and helping the better!

                            also, if you haven't updated to the latest version please do!

                            php-curl is required, that's correct.

                            Comment


                              #15
                              Ok. So i was trying to see if there's a hint of something missing but i didn't find anything. Here's what i got on "pdfform.php":

                              CURL URL: http://localhost/api_jsonrpc.php
                              CURL Options: Array ( [19913] => 1 [13] => 30 [78] => 5 [81] => [64] => [52] => 1 [74] => 1 [10023] => Array ( [0] => Content-Type: application/json-rpc [1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api ) [10036] => POST [10015] => {"auth":null,"method":"user.authenticate","id":1," params":{"password":"mypassword","user":"myusernam e"},"jsonrpc":"2.0"} [10102] => gzip ) Got response from API: ({"jsonrpc":"2.0","result":"fea29a29ee38cf3cc9f57a 2f73c486ae","id":1}) Response decoded: (Array ( [jsonrpc] => 2.0 [result] => fea29a29ee38cf3cc9f57a2f73c486ae [id] => 1 ) __login() Got response from API: (fea29a29ee38cf3cc9f57a2f73c486ae) CURL URL: http://localhost/api_jsonrpc.php
                              CURL Options: Array ( [19913] => 1 [13] => 30 [78] => 5 [81] => [64] => [52] => 1 [74] => 1 [10023] => Array ( [0] => Content-Type: application/json-rpc [1] => User-Agent: ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api ) [10036] => POST [10015] => {"auth":"fea29a29ee38cf3cc9f57a2f73c486ae","method ":"host.get","id":1,"params":{"extendoutput":"shor ten","sortfield":"host"},"jsonrpc":"2.0"} [10102] => gzip ) Got response from API: ({"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"No API access"},"id":1}) Response decoded: (Array ( [jsonrpc] => 2.0 [error] => Array ( [code] => -32602 [message] => Invalid params. [data] => No API access ) [id] => 1 )

                              In order to show this here i change my real username to "myusername" and my real password to "mypassword".

                              Comment

                              Working...
                              X