Ad Widget

Collapse

PATCH: 1.4.2 Gradient Graph Lines

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #1

    PATCH: 1.4.2 Gradient Graph Lines

    Topka posted a question about having gradient lines in Zabbix. It sounded like a fun hack and a few hours later it was done.

    It's a fairly straightforward hack. When you create a graph you have the ability to add an item with it's line type of "Gradient Line". It will then take the color of the line you chose and create a gradient from that color to white/opaque below that line. The gradient goes from the line to the bottom of the graph. When there are jagged nearly vertical lines in the graph the gradient graph does not look very good. The was most often observed in testing with Processor load with a resolution of 5 seconds. Changing that to 15 or 30 improved quality on a 1hr graph.

    The patch will work with any color and with multiple items. No Changes are needed to the database.

    NOTE:
    If your php version does not use true-color images gradient graphs will not work. I added some code to detect the use of true-color image functions. If your php does not use true-color you will only see a normal line. This is due to the need for an alpha channel and the way php handles color variables.

    To apply the patch.
    1) Save the patch to your system
    2) Change into your Zabbix directory
    eg "cd /srv/www/htdocs"
    3) Apply the patch
    patch -p1 < /path/to/your/patch/gradient.patch

    Please post any problems encountered.
    Attached Files
    Last edited by nelsonab; 28-10-2007, 08:29. Reason: Added note about true-color, corrected error in patch
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Thank you for the patch. I will try to integrate it into 1.4.3, it is registered as ZBX-125 in our support system.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • Palmertree
      Senior Member
      • Sep 2005
      • 746

      #3
      Great Patch. Another cool thing would be able to change the background color of the graph to black or any other color.

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        That's pretty easy however it will involve a change to the database making it nonstandard and complicating the upgrade path. Perhaps for 1.5? Alexei??
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        • topkoa
          Member
          • Oct 2007
          • 47

          #5
          Slight tweak-

          Hey- your patch works great..

          I was wondering if you would mind adding one small tweak to it?

          I have been using it with my temperature gages and I think a specific color gradient would be preferrable-

          Check the following link for an example of what I mean:



          Thanks again, and please forgive me for being a pain..

          Comment

          • nelsonab
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2006
            • 1233

            #6
            Hmm A shaded gradient. It would be pretty easy to hack overall. I'll give it some thought, there are some limitations right now with graphs and items.

            Alexi what are your thoughts to having a general field for specific item/graph related options in the gitems table? As an example you could use the field to store a start/end color or other options. I'm thinking a varchar(255). Your thoughts?
            RHCE, author of zbxapi
            Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
            Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

            Comment

            • Alexei
              Founder, CEO
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Sep 2004
              • 5654

              #7
              Originally posted by nelsonab
              Alexi what are your thoughts to having a general field for specific item/graph related options in the gitems table? As an example you could use the field to store a start/end color or other options. I'm thinking a varchar(255). Your thoughts?
              I am not happy about "universal" fields in the database structure. Anyway feel free to implement it in your way, I will review the changes and adjust the code and database changes as well.
              Alexei Vladishev
              Creator of Zabbix, Product manager
              New York | Tokyo | Riga
              My Twitter

              Comment

              • Palmertree
                Senior Member
                • Sep 2005
                • 746

                #8
                Graph Background Colors

                I was going to try and take a hack at the background color in the graphs but can not locate the code for the default background colors. Does anyone know where I should start looking? I was looking around in the file graphs.inc.php. If anyone else wants to take a hack at this too, please feel free to do so.

                Comment

                • nelsonab
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Sep 2006
                  • 1233

                  #9
                  The background is drawn in the drawWorkPeriod() method located in includes/classes/graph.inc.php

                  There are two sections to the method. The first draws the normal work period in white and the second will draw the non-work period in grey. After that drawGrid() gets called in the Draw() method.
                  RHCE, author of zbxapi
                  Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                  Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                  Comment

                  Working...