Ad Widget

Collapse

Zabbix Dynamic PDF Report Generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RonnyP
    Junior Member
    • Sep 2014
    • 5

    #196
    When do you get this error? Accessing the index.php page?
    What happens if you go to the Zabbix report-page directly (not through screen)?
    I assume you adjusted the values in config.inc.php to match your environment?

    Comment

    • Diwahar
      Junior Member
      • Sep 2014
      • 15

      #197
      Zabbix Dynamic PDF Report Generation

      I'm also getting same error...


      Can you help me???
      Attached Files

      Comment

      • johnatan.camargo
        Junior Member
        • Oct 2014
        • 3

        #198
        Originally posted by RonnyP
        When do you get this error? Accessing the index.php page?
        What happens if you go to the Zabbix report-page directly (not through screen)?
        I assume you adjusted the values in config.inc.php to match your environment?
        Yes. This error occurs when access: http://10.1.1.251/zabbix/zabbix_dyna...port/index.php

        Follow my config file below:
        # zabbix server info(user must have API access)
        $z_server = 'http://10.1.1.251/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";
        # 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 = 'America/Sao Paulo';
        # Logo used in PDF - may be empty
        # TODO: Specify image size!
        $pdf_logo = './images/zabbix.png';
        $company_name = 'Zabbix';
        Zabbix version 2.2

        Comment

        • RonnyP
          Junior Member
          • Sep 2014
          • 5

          #199
          Originally posted by johnatan.camargo
          Yes. This error occurs when access: http://10.1.1.251/zabbix/zabbix_dyna...port/index.php

          Follow my config file below:
          Zabbix version 2.2
          Ok. It may be because Zabbix now have removed user.authenticate from 2.2 API as well.
          Could you test by modifying inc/ZabbixAPI.class.php? Find this section (line 279-284):
          Code:
              /**
               * Private login function to perform the login
               */
              private function __login() {
                  // Try to login to our API
                  $data = $this->__callAPI('user.authenticate', array( 'password' => $this->password, 'user' => $this->username ));
          Replace: user.authenticate
          With: user.login
          and let me know how this works. I'll investigate further tomorrow.

          Comment

          • rsimons
            Junior Member
            • Oct 2014
            • 2

            #200
            Originally posted by RonnyP
            Ok. It may be because Zabbix now have removed user.authenticate from 2.2 API as well.
            Could you test by modifying inc/ZabbixAPI.class.php? Find this section (line 279-284):
            Code:
                /**
                 * Private login function to perform the login
                 */
                private function __login() {
                    // Try to login to our API
                    $data = $this->__callAPI('user.authenticate', array( 'password' => $this->password, 'user' => $this->username ));
            Replace: user.authenticate
            With: user.login
            and let me know how this works. I'll investigate further tomorrow.

            Also change line 250-251
            Code:
                    if ($this->auth_hash == NULL && $method != 'user.authenticate')
                        return false;  // If we're not logged in, no wasting our time here
            Replace: user.authenticate
            With: user.login

            For me applying both changes to the api worked.

            Comment

            • Diwahar
              Junior Member
              • Sep 2014
              • 15

              #201
              Zabbix Dynamic PDF Report Generation

              Originally posted by rsimons
              Also change line 250-251
              Code:
                      if ($this->auth_hash == NULL && $method != 'user.authenticate')
                          return false;  // If we're not logged in, no wasting our time here
              Replace: user.authenticate
              With: user.login

              For me applying both changes to the api worked.


              Still I have same issue.

              Comment

              • Diwahar
                Junior Member
                • Sep 2014
                • 15

                #202
                Zabbix Dynamic PDF Report Generation

                Originally posted by rsimons
                Also change line 250-251
                Code:
                        if ($this->auth_hash == NULL && $method != 'user.authenticate')
                            return false;  // If we're not logged in, no wasting our time here
                Replace: user.authenticate
                With: user.login

                For me applying both changes to the api worked.

                Still i'm getting same error, its not working.

                Comment

                • AndRec
                  Junior Member
                  • Dec 2014
                  • 6

                  #203
                  Originally posted by RonnyP
                  I've rewritten most of the code for the Dynamic PDF Generator to suit me better. I have not done much changes with the code that do the actual PDF generation.
                  Maybe someone else will find this modified version useful as well.

                  I don't use this through a screen since the screen refreshes, and some larger reports may take a while to generate.
                  I just install this under the web-folder as "report". You may need to adjust some parameters in config.inc.php, in particular:
                  $z_server = 'http://your-zabbix-server-address/zabbix/';
                  $z_user = 'Admin';
                  $z_pass = 'ChangePassword';
                  $company_name = 'Zabbix'; // Used in PDF Report

                  The index page now is a bit more loaded with Javascript - mostly Jquery to help with typeable selector, calendar, hiding/displaying fields based on radio buttons.

                  Changes (that I can remember :
                  * inc/: Moved included files to its own folder
                  * js/ : Created javascript (jquery) files in its own folder
                  * css/: Moved css files to its own folder. Added some of Zabbix CSS to
                  these.
                  * index.php: Rewrote all of "pdfform.php" and created it as just index.php.
                  * index.php: Allows reporting on group. Uses GroupID and HostID from
                  Zabbix API (not name).
                  * index.php: Uses Jquery (javascript) for many of the functions on the index page.
                  * index.php: Uses Jquery Calendar to select range for custom timeframe
                  * index.php: Uses Jquery Selector2 where you can search in the select
                  box. Good for installations with many groups/hosts.
                  * createpdf.php: Merged and rewrote code for pdf.php and
                  generatedreport.php.
                  * createpdf.php: Stores created reports in reports subdirectory. Does
                  * createpdf.php: Added some sanitization with filter_input on some
                  _GET variables. Need to implement on more.
                  * inc/index.functions.php: Moved some common function in index.php to
                  an included file
                  * inc/createpdf.functions.php: Moved common function from createpdf.php

                  Download:
                  https://www.dropbox.com/s/sfhw8gy0dr...t.v05.zip?dl=0

                  That worked perfectly here, thanks

                  I would just like to know whether it is possible to generate the reports without using a browser. I mean, I would like to generate them automatically in my Ubuntu Server. Is it possible?

                  Thanks!



                  EDIT: Well, probably it is possible using PhantomJS, but I would have to spend some hours to understand how to use it... can anyone think a simpler way to generate the pdfs?
                  Last edited by AndRec; 18-12-2014, 08:07.

                  Comment

                  • johnatan.camargo
                    Junior Member
                    • Oct 2014
                    • 3

                    #204
                    Originally posted by rsimons
                    Also change line 250-251
                    Code:
                            if ($this->auth_hash == NULL && $method != 'user.authenticate')
                                return false;  // If we're not logged in, no wasting our time here
                    Replace: user.authenticate
                    With: user.login

                    For me applying both changes to the api worked.

                    Hello people!
                    I made the changes as recommended more my problem continue...

                    [Wed Jan 14 15:11:33 2015] [error] [client 10.1.1.82] PHP Fatal error: Call to undefined function json_encode() in /usr/share/zabbix/report/inc/ZabbixAPI.class.php on line 236
                    [Wed Jan 14 15:11:38 2015] [error] [client 10.1.1.82] PHP Fatal error: Call to undefined function json_encode() in /usr/share/zabbix/report/inc/ZabbixAPI.class.php on line 236
                    The above error occurs when access the index.php.
                    My config:

                    # zabbix server info(user must have API access)
                    $z_server = 'http://10.1.1.251/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";
                    # 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 = 'America/Sao Paulo';
                    # Logo used in PDF - may be empty
                    # TODO: Specify image size!
                    $pdf_logo = './images/zabbix.png';
                    $company_name = 'Zabbix';


                    Where can I be wrong?

                    Comment

                    • lgalford
                      Junior Member
                      • Aug 2014
                      • 21

                      #205
                      Help Installing the reporter

                      Hi,

                      I'm new at this subject, and I would like to know the procedure for the installation of this module. is there an installation model. waiting fir your replay

                      rgds
                      Luis Alford

                      Comment

                      • lgalford
                        Junior Member
                        • Aug 2014
                        • 21

                        #206
                        Installing issues

                        Hi,

                        I heve install following the directions and i get the following error.

                        Unable to login: Array ( [code] => -32602 [message] => Invalid params. [data] => Incorrect method "user.authenticate". )

                        Any Idea..
                        thanks

                        ------------------------------------------------------------------------------------------------------------------------------------

                        I change the report authetication and now it seem to be passing that point, the issue now is that i get this message

                        Report type not selected!

                        but it does not show anything else on the screen, am i missing something ?

                        waiting for your replay

                        Regards
                        Luis

                        ------------------------------------------------------------------------------------------------------------------------

                        Good afternnon

                        I was not referencong the index.php now I see the select your report and everything now when I try to generate a report a see the message


                        HostID: 10084
                        Report Type: host
                        Time Period: 3600
                        Temp image path: /usr/share/zabbix/report/tmp/zabbix_report_ySrYio

                        Zabbix server(id:10084)
                        Zabbix internal process busy %(id:517)
                        Zabbix data gathering process busy %(id:518)
                        Zabbix server performance(id:519)
                        Zabbix cache usage, % free(id:520)
                        CPU jumps(id:523)
                        CPU load(id:524)
                        CPU utilization(id:525)
                        Swap usage(id:526)
                        Value cache effectiveness(id:528)
                        Memory usage(id:534)
                        Report ready - available as: http://latccszabbix2.cloudapp.net/zabbix/report/reports/Zabbix_server.pdf

                        If I open this link I get the report but shouldn't this be opened automathically, and one more question can I add more information to the reports.
                        Last edited by lgalford; 23-02-2015, 23:35.

                        Comment

                        • lgalford
                          Junior Member
                          • Aug 2014
                          • 21

                          #207
                          The reports keeps refreshing

                          Hi,

                          I have an issue the reports are running and sometimes the page refresh before the report is done

                          Comment

                          • sharps
                            Junior Member
                            • Feb 2015
                            • 2

                            #208
                            does not print reports, png in tmp_image less 1Kb, installed zabbix 2.0.12
                            config.inc.php
                            <? Php
                            // CONFIGURABLE
                            # Zabbix server info (user must have API access)
                            $ Z_server = 'http://172.16.61.122/zabbix/';
                            $ Z_user = 'Admin';
                            $ Z_pass = 'XXXXXXX';
                            # Tmp_images directory path
                            # $ Z_img_path = 'report / tmp_images /';
                            $ Z_img_path = '/ var / www / localhost / htdocs / zabbix / zabbix_report_generation / tmp_images /';
                            # Should be the tail of the URL
                            $ Pdf_location = $ z_server. "/ Zabbix_report_generation / pdf.php";
                            # $ Pdf_location = "report / pdf.php";
                            # Paper settings
                            $ Paper_format = 'LETTER'; // 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
                            $ Timezone = 'EST';

                            // DO NOT CHANGE BELOW THIS LINE
                            $ Z_tmp_cookies = "";
                            $ 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. "& Enter = Enter";
                            $ Data = './data.txt';
                            ?>

                            Installed versions: 5.4.36 (5.4) (20:45:11 26.02.2015) (apache2 bcmath berkdb bzip2 calendar cli crypt ctype curl exif fileinfo filter ftp gd gdbm gmp hash iconv json ldap mysql mysqli nls pcntl phar posix readline session simplexml soap sockets spell ssl systemd sysvipc tokenizer truetype unicode wddx xml xmlreader xmlrpc xmlwriter zip zlib -cdb -cgi -cjk -curlwrappers -debug -embed -enchant -firebird -flatfile -fpm -imap -inifile -intl -iodbc -ipv6 -kerberos -ldap- sasl -libedit -mhash -mssql -mysqlnd -oci8-instant-client -odbc -pdo -postgres -qdbm -recode -selinux -sharedmem -snmp -sqlite -sybase-ct -threads -tidy -xpm -xslt)

                            Comment

                            • martinm_76
                              Member
                              • Mar 2015
                              • 57

                              #209
                              Updated report (0.8) - Triggers/Acknowledgements/Fixes/user login.

                              Hi folks!

                              I have had the good fortune to use the previous iterations of this report and have added some extra functionality that we wanted in our environment, such as:

                              * Option for customer to log on and only see their servers (both in drop-down and old reports).
                              * Show the triggers and acknowledgements a given host has had in the periode selected.
                              * Various fixes to the layout so elements stay within the bounds of the page and without going into the footer or header.
                              * Internationalization support. Extended characters needed to be converted from UTF-8 to a latin character set. I have gone with ISO-8859-1, but you can change it if needed. I have not made it a config item at this point.

                              I have placed my version in a TGZ-file on Google Drive (thus you should not need to set rights on tmp and reports directories). I hope this will be of use to some of you as well, and maybe you some of you can help me with the things I still don't know how to get at:

                              Code:
                              PLANNED:
                              	* HTML data for triggers/acknowledgements with fuller details. Right
                              	now only the subject is shown in the PDF (or the message in the case
                              	of acknowledgements). The reports would tend to get pretty big if the
                              	full body of the event is included. I plan to make the events
                              	collapsible, mostly like the 'show old reports' functionality from
                              	Ronny.
                              	* I would like to include basic trending information, a decent
                              	approximation of uptime for host and various important checks. As far
                              	as I can tell, this is not really posible with the API today (2.4.x)
                              I guess, as a temporary measure, I can include the current value of the Zabbix agent uptime check and the like, but that doesn't tell me about periods of unreachability and such (although the triggers gives a basic look at this).

                              Get the file here:


                              Happy reporting!

                              /Martin.

                              Comment

                              • selvakumaran
                                Junior Member
                                • Dec 2014
                                • 22

                                #210
                                Zabbix Dynamic PDF Report Generation

                                Hi All,
                                i am new to this. I have installed Zabbix 2.4 successfully. i want to configure schedule report via mail. i have downloaded zabbix-pdf-report-0.8, but i don't know how to configure the report. kindly help me how to configure step by step.

                                Comment

                                Working...