Ad Widget

Collapse

Zabbix Dynamic PDF Report Generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mython
    Junior Member
    • May 2013
    • 11

    #136
    Originally posted by wamsterdam
    Mython,

    Meanwhile I changed the original files supplied by Axilla a bit. I switched to use the Zabbix PHP API from http://zabbixapi.confirm.ch (which syntax I could understand better than the original one) and I switched to use another PDF class from http://www.tcpdf.org. So my files are changed quite drastically.

    I may have missed some posts, but you have reached the point that your PDF is created without the graph images. Are the images created in the tmp_images folder? Did you set up the correct folder permissions as noted in Boe's reply in post #128?

    Wouter
    Wouter,
    Thanks you very much for your reply!, in my case the issue has been solved too.. (using the same steps that boe posted )
    As I only need to generate a common report by host, the pdf generator is good for me...

    On the other hand, if you find a new way to generate them.. please let us know !

    Thanks again!

    Comment

    • stevodude
      Junior Member
      • Jul 2013
      • 1

      #137
      failed implementation of the pdf graphs

      Hi guys,

      just trying to get an idea of where things are wrong, and possible places to look for how to make the graphs work.

      have zabbix 2.0.6, and has modules json & curl

      installed the custom graph php's and modified php and permissions as per process.

      going to: http://zabbix/custom_pages/zabbix_re...on/pdfform.php

      I get the following error (with username/password changed)

      CURL URL: http://zabbix/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":"password","user":"user"},"jso nrpc":"2.0"} [10102] => gzip ) Got response from API: () Response decoded: ( __login() Got response from API: () Unable to login

      Any help would be appreciated

      Cheers, Stevo

      Comment

      • wamsterdam
        Member
        • Apr 2013
        • 34

        #138
        Stevo,

        Does your user have API access in Zabbix? You can check/change this via Zabbix frontend: Administration > Users. The user should be member of the group "API Access".

        Wouter

        Comment

        • nicod
          Junior Member
          • Sep 2013
          • 1

          #139
          -- edited by Nico

          Never mind - I should have read the rest of the thread :-)
          Last edited by nicod; 04-09-2013, 17:37. Reason: found the solution - should have spend a few more minutes searching for an answer

          Comment

          • Mython
            Junior Member
            • May 2013
            • 11

            #140
            Originally posted by stevodude
            Hi guys,

            just trying to get an idea of where things are wrong, and possible places to look for how to make the graphs work.

            have zabbix 2.0.6, and has modules json & curl

            installed the custom graph php's and modified php and permissions as per process.

            going to: http://zabbix/custom_pages/zabbix_re...on/pdfform.php

            I get the following error (with username/password changed)

            CURL URL: http://zabbix/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":"password","user":"user"},"jso nrpc":"2.0"} [10102] => gzip ) Got response from API: () Response decoded: ( __login() Got response from API: () Unable to login

            Any help would be appreciated

            Cheers, Stevo
            Hi Stevo ,

            Check the Authentication mode.. and check if the user that you are using in the conf file have the proper rights...
            **********************
            Default authentication:

            *Internal

            *LDAP

            *HTTP
            **********************
            Just to remove another possible reason from the list...

            Regards

            Comment

            • notnightman
              Junior Member
              • Apr 2013
              • 10

              #141
              This is a great thread and fills a big gap as we rely on emailed reports from another similar tool to share with the rest of the company. Thanks to marakshin and Axilla I have this working on 2.0.6 with no issues.

              Has anyone made any progress on getting graphs for a host group? Or just the ability to select individual graphs?

              There are a lot of people looking to email these out so I thought I'd point out that this should be fairly straight forward using cron/wget. This is what I execute weekly to share some performance metrics.

              wget --output-document=/tmp/pdf.pdf "http://hostname/zabbix/custom_pages/generatereport.php?siteList=asite&timePeriod=Week" ; uuencode /tmp/pdf.pdf Report.pdf | mail -s "Weekly Reports" [email protected]

              Comment

              • notnightman
                Junior Member
                • Apr 2013
                • 10

                #142
                Generate Report for list of hosts

                I asked a coworker who has some PHP experience to take a look and we can now generate reports with a list of hosts.

                There's no UI since we call generatereport directly via CRON. I've attached the updated PHP file. Just put this beside the existing generatereport.php page and you should be good to go.

                A usage example is:
                Attached Files

                Comment

                • guilherme.paiva
                  Junior Member
                  • Sep 2013
                  • 1

                  #143
                  I have a new suggestion for Dynamic PDF, include specific period equal to the Bar reports.

                  Comment

                  • Guruit
                    Junior Member
                    • Oct 2013
                    • 1

                    #144
                    PDF report generation

                    I have a need to prepare a PDF of four graphs. The graphs are aggregate reports of 68 render nodes, the way I created the graphs was in four of the nodes there is a graph the that includes other hosts CPU load information , so node1 has node 1 to node 15, node 16 has node 16 to 30, node 31 has node 31 to 48, and mode 49 has node 49 to node 68.

                    I need to have these 4 graphs alone in a PDF, I have the report generation source from Dec 13 2012.

                    Any help would be appreciated

                    Comment

                    • csf
                      Senior Member
                      • Nov 2007
                      • 154

                      #145
                      Hi All,

                      How can I fix this:

                      zabbix:/var/log/apache2:

                      PHP Fatal error: Call to undefined function curl_init() in /srv/www/htdocs/custom_pages/ZabbixAPI.class.php on line 287

                      Any Ideas ?

                      Comment

                      • steveboyson
                        Senior Member
                        • Jul 2013
                        • 582

                        #146
                        http://stackoverflow.com/questions/6...tion-curl-init

                        Comment

                        • csf
                          Senior Member
                          • Nov 2007
                          • 154

                          #147
                          Thank you very much ! Not installed the package php5-curl.
                          But now a new problem:
                          /var/log/apache2/error_log:

                          PHP Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/custom_pages/ZabbixAPI.class.php:244) in /srv/www/htdocs/custom_pages/generatereport.php on line 141, referer: //172.16.1.122/custom_pages/pdfform.php

                          and in Screens-"Report":

                          CURL URL: http://172.16.1.122/api_jsonrpc.php
                          CURL Options: Array ( [19913] => 1 [13] => 30 [78] => 5 [81] => [64] =>
                          .......................

                          Comment

                          • vimets
                            Junior Member
                            • Dec 2013
                            • 3

                            #148
                            Hi there,
                            First of all I want to thank you because i've been using this with zabbix 2.0 with a cron job scheduled that does de work and works like a charm.
                            Now, i'm planning to update to 2.2 and i've been testing compatibility issues and i had one with this error-generator package.
                            I don't know if it's the API that has changed, but now, in the pdfform.php i get:
                            "Unable to login"
                            If I call it from the command line, i get the same message
                            I know you don't give support for the new versions and that this has been tested with older versions, is just that there are no other place to post this in case anyone has the same situation.
                            Thanks

                            Comment

                            • notnightman
                              Junior Member
                              • Apr 2013
                              • 10

                              #149
                              I've been using this with 2.2.1 with no issues. It could help that I have allowed the guest account to have read access to all the hosts that I generate PDF reports for.

                              Comment

                              • vimets
                                Junior Member
                                • Dec 2013
                                • 3

                                #150
                                Originally posted by notnightman
                                I've been using this with 2.2.1 with no issues. It could help that I have allowed the guest account to have read access to all the hosts that I generate PDF reports for.
                                And then, in the config.inc.php, which user do you configure? the guest?
                                I've given read and read-write perms to the guest and nothing changes.
                                Thanks for the reply, thought this thread was dead.
                                Bless

                                UPDATE:
                                Hi there again, finally I could make it work. In the config.inc.php I put http://localhost/ as the server, instead of the real URL. I also changed all the private/restricted methods for public in the ZabbixAPI.class.php.
                                Thanks for your time/support.
                                See you around
                                Bless
                                Last edited by vimets; 29-01-2014, 10:30. Reason: Script running

                                Comment

                                Working...