Ad Widget

Collapse

PDF monitoring reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stankju
    Junior Member
    • Jul 2005
    • 3

    #1

    PDF monitoring reports

    I have made a php script witch create monitoring reports in PDF on the fly.
    I use the FPDF library to do that.

    To have this working, follow theses steps :

    1) get FPDF lib
    Download it from www.fpdf.org
    unzip or untar in web directory, like /var/www/

    2) get my script 'pdf_gen.php' (see attach file)
    Copy it in the root directory of zabbix release, for exemple /var/www/html/zabbix

    3) create a tmp directory and set correct rights (always in the same directory)
    mkdir tmp
    chown apache tmp

    4) Edit the 'pdf_gen.php' script
    set correct path to pdflib : require('<path.to.FPDF>/fpdf.php');
    modify $ZABBIX, it must be <your.server>/<path.to.zabbix>

    5) use it !
    get id of a host group, for exemple 36 and go to :
    http://<your.server>/<path.to.zabbix>/pdf_gen.php?grp=36
    This generate a PDF witch contains errors and graphs for all hosts in the specified group.

    You can specified several argument : interval, ... see source code.

    Hope this scipt can help you ...
    Attached Files
  • rdg
    Junior Member
    • Jun 2005
    • 20

    #2
    Excellent, exactly what I was looking for. Can we see this one in the next release of Zabbix please?

    /Robert

    Comment

    • Neo
      Member
      • Jun 2005
      • 59

      #3
      I use zabbix 1.0, how do i use this group feature?
      BTW the FDPF thing looks cool.
      Last edited by Neo; 01-08-2005, 10:38.

      Comment

      • rdg
        Junior Member
        • Jun 2005
        • 20

        #4
        Im using 1.1 alpha 10, maybe you have to upgrade. Anyway, find the group id for your hosts by clicking Configuration, Hosts, Select Hosts groups.

        Then go to :
        http://<your.server>/<path.to.zabbix>/pdf_gen.php?grp=<group id>

        /Robert

        Comment

        • pabloadmin
          Member
          Zabbix Certified Specialist
          • Jan 2005
          • 67

          #5
          Hi Stankju,

          I was working with an interfase to pass the values to your php, but i don't understand some things. Could you help me?


          arguments :
          ===========

          1) group id

          - This is the group id

          2) From (number of hour from now)

          - What is it?

          2b) Interval (timestamp in second)

          - This is the period as the standart graphs.

          3) Wanted detail level, show error when error percent > $detailLevel (in percent, 0 = one single line summary)

          - What is it?

          4) Wanted priority level (valid value are between 0 to 5)

          - What is it?


          5) Include graphs ?
          Include graph, yes or not.


          Thank you.

          Comment

          • rdg
            Junior Member
            • Jun 2005
            • 20

            #6
            It would be great if you could add an option to select a host. I would like to print a report for one host only.

            Thanks

            Robert

            Comment

            • Neo
              Member
              • Jun 2005
              • 59

              #7
              All I get with it is a PDF file with 2 pages, the first page has the date, hosts, period and a "Detected problems" heading. After that the page is blank except for the header and footer. The second page is balnk too.
              Has anyone tried this with 1.0 and have the same problem?

              Also I noticed another problem.
              With Group ID's > 6 (i.e 7 and above I get this error)
              FPDF error: Can't open image file: tmp/test18.png
              the above is for id=7
              with 8 the filename is tmp/test118/png
              Where is it getting this from?

              Comment

              • Stankju
                Junior Member
                • Jul 2005
                • 3

                #8
                Hi pabloadmin !

                My script gets graphs from zabbix. To include picture it needs a starting point (from value) and a duration (interval value). Theses values are the same that you can see in the URL on Zabbix graph page.Let's take an example: current time is 10AM. You want a graph from 7 to 9, so "from" is 3 and "interval" is 7200 (2 hours equal 7200 seconds).

                Wanted priority level is for "Detected problems" part. The script uses Zabbix triggers. When a trigger goes on, a line is inserted in the corresponding trigger table. Here is the Zabbix trigger level :
                NOT_CLASSIFIED = 0
                INFORMATION = 1
                WARNING = 2
                AVERAGE = 3
                HIGH = 4
                DISASTER = 5

                If you want only DISASTER trigger in your repport, set "priorityPb" to 5.
                If you want HIGH and DISASTER, set "priorityPb" to 4.
                etc ...


                You can reduce the size of "Detected problems" part with the Wanted detail level. If you set "detail" to 3, all detected problems witch have an impact smaller than 3% will be deleted. Set it very smaller to have a big table containing all the alert.


                I hope my explanations are clear ...


                Originally posted by pabloadmin
                Hi Stankju,

                I was working with an interfase to pass the values to your php, but i don't understand some things. Could you help me?


                arguments :
                ===========

                1) group id

                - This is the group id

                2) From (number of hour from now)

                - What is it?

                2b) Interval (timestamp in second)

                - This is the period as the standart graphs.

                3) Wanted detail level, show error when error percent > $detailLevel (in percent, 0 = one single line summary)

                - What is it?

                4) Wanted priority level (valid value are between 0 to 5)

                - What is it?


                5) Include graphs ?
                Include graph, yes or not.


                Thank you.

                Comment

                • pabloadmin
                  Member
                  Zabbix Certified Specialist
                  • Jan 2005
                  • 67

                  #9
                  Yes, thank you.

                  Comment

                  • bigJoe
                    Junior Member
                    • Dec 2005
                    • 5

                    #10
                    Hi,

                    When I go on the <server>/zabbix/pdf_gen.php?grp=36 I received a blank page. what mistake?

                    Comment

                    • exy123
                      Junior Member
                      • Feb 2006
                      • 8

                      #11
                      Thanks for a great Tool , I am just seeking some help regarding it becuase I must be running my queries to php inccorectly.

                      I am typing the following :

                      http://servername/zabbix/pdf_gen.php?grp=2?period=3 or


                      but it returns

                      Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /srv/www/htdocs/zabbix/include/db.inc.php on line 98

                      How must I pass second variables to your script to have it recognized ?
                      Some exmaples would help greatly.

                      Regards

                      Comment

                      • navtek007
                        Senior Member
                        • May 2005
                        • 100

                        #12
                        does this still work with beta 6? I haven't tried this with earlier betas but I keep getting the following error:

                        Fatal error: Call to undefined function: dbget_field() in /var/www/html/zabbix/pdf_gen.php on line 392

                        I couldn't find this function anywhere in config.inc.php.

                        Have i missed something?

                        Thanks,

                        Comment

                        • navtek007
                          Senior Member
                          • May 2005
                          • 100

                          #13
                          just an update on my last post. the dbget_field() is now called get_field so to make the reports work in beta6 you have to change all the dbget_field() functions to get_field() in the pdf_gen.php file.

                          Thanks.

                          Comment

                          • navtek007
                            Senior Member
                            • May 2005
                            • 100

                            #14
                            Hi,

                            Whenever I try and run a report from anymore then a month in history i keep getting the following errors:

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

                            Warning: Division by zero in /var/www/html/zabbix/pdf_gen.php on line 218

                            Warning: Division by zero in /var/www/html/zabbix/pdf_gen.php on line 218

                            Warning: Division by zero in /var/www/html/zabbix/pdf_gen.php on line 218

                            Warning: Division by zero in /var/www/html/zabbix/pdf_gen.php on line 218

                            Warning: Division by zero in /var/www/html/zabbix/pdf_gen.php on line 218

                            Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/zabbix/pdf_gen.php:218) in /var/www/html/fpdf/fpdf.php on line 1022
                            FPDF error: Some data has already been output to browser, can't send PDF file

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

                            My parameters when submitting the report are:

                            from=730 (1 Month ago)
                            period=2628000 (1 Month)

                            Thanks.

                            Garon.

                            Comment

                            • bbrendon
                              Senior Member
                              • Sep 2005
                              • 870

                              #15
                              Has anything been done to update these for zabbix 1.4.x ?
                              Are there any reports for 1.4.x other than the basic ones in the php interfaces?
                              Unofficial Zabbix Expert
                              Blog, Corporate Site

                              Comment

                              Working...