Ad Widget

Collapse

PATCH: Multiple fixes against 1.1.5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James Wells
    Senior Member
    • Jun 2005
    • 664

    #1

    PATCH: Multiple fixes against 1.1.5

    Greetings,

    The attached patch is against the 1.1.5 version of Zabbix. It contains a number of fixes and adjustments needed by Zabbix to deal with large deployments. At present, we have over 25000 items, 17000 triggers, and over generate over 14GB per day worth of data. This patch contains;
    1. Graph Item Grouping Patch. This patch groups item in the add graph page so that the items are grouped by host.
    2. The Add 'Create Trigger' on Item Page patch. This patch was submitted by Gerco.
    3. Trigger Comment Protection Patch. The patch requires a user to log in before being given the option to comment on triggers. Guests and un-authorized users will still be able to see comments, but they are not even given the option to update the comments. When you have over 90 registered users, some of them are bound to try, only to get rejected.
    4. Trigger Dependency Filter Patch. When you have as many triggers as we do, it often takes 3 - 4 minutes to get the entire list of triggers for the trigger dependency tree on the add triggers page. Then when you finally get the list finding the trigger you want can often be a very painful process. By default, patch filters the trigger list to just the triggers related to this host, however, you are able to see all triggers at any time by simply clicking on the filter button.


    EDIT: For some reason the patch missed a couple lines. I have attached the corrected patch.
    Attached Files
    Last edited by James Wells; 27-01-2007, 08:14.
    Unofficial Zabbix Developer
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #2
    James,

    Thanks for the patch. It worked great. I had to remove the "-" sign off one of the patch lines because the "}" (close bracket) did not have an associated open "{" (open bracket) for the tr_status.php file. It was showing a blank page unitl I fixed this. It might be my setup on my end. I highlighted the section in red below. I hope this helps someone else out. :-)



    diff -ruN zabbix_current/frontends/php/tr_status.php zabbix/frontends/php/tr_status.php
    --- zabbix_current/frontends/php/tr_status.php 2007-01-26 05:57:58.000000000 -0800
    +++ zabbix/frontends/php/tr_status.php 2007-01-26 19:12:21.000000000 -0800
    @@ -39,19 +39,6 @@

    $new=explode(",",$tr_hash);
    $old=explode(",",$triggers_hash);
    - setcookie("zbx_triggers_hash",$tr_hash,time()+1800 );
    -
    - if(!isset($_COOKIE["zbx_triggers_hash"]))
    - {
    - $triggers_hash="0,0";
    - }
    - else
    - {
    - $triggers_hash=$_COOKIE["zbx_triggers_hash"];
    - }
    -
    - $new=explode(",",$tr_hash);
    - $old=explode(",",$triggers_hash);

    // Number of trigger decreased
    // echo $new[0]," ",$old[0];
    @@ -608,8 +595,10 @@
    $comments=new CLink(S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action");
    }
    else
    - {
    - $comments=new CLink(S_ADD,"tr_comments.php?triggerid=".$row["triggerid"],"action");
    + if(check_right("Trigger comment","U",$row["triggerid"]))
    + {
    + $comments=new CLink(S_ADD,"tr_comments.php?triggerid=".$row["triggerid"],"action");
    + }
    }

    $ack = "-";

    Comment

    • James Wells
      Senior Member
      • Jun 2005
      • 664

      #3
      Thanx for the heads up, somehow the upload was corrupted. I have fixed it.
      Last edited by James Wells; 27-01-2007, 08:15.
      Unofficial Zabbix Developer

      Comment

      • zipitup
        Junior Member
        • Dec 2006
        • 9

        #4
        Hello,

        How do I apply the patch?

        Just save it as an .sh file and run it?

        Thanks!

        Comment

        • krelac
          Junior Member
          • Oct 2006
          • 24

          #5
          patch -p0 < patch

          Comment

          • James Wells
            Senior Member
            • Jun 2005
            • 664

            #6
            I have massively updated this patch, adding some new features, and fixing all of the issues that I am aware of. Additionally, this patch adds the ability to silence alert emails by acknowledging them on the triggers page.

            Please note that this patch also adds hooks for a couple of new features. These features are not yet enabled, but the hooks have been added to make adding these features easier.

            To take advantage of the alert silencer, you will need to add two fields to your Zabbix DB. These can be added with the following SQL commands;
            Code:
            alter table config add ackduration int(4) DEFAULT '1800' NOT NULL;
            alter table alerts add ackuntil int(4) DEFAULT '0' NOT NULL;
            Finally, note that none of these features have been accepted into Zabbix as of yet, and as such may not be in 1.1.6 or higher.
            Attached Files
            Unofficial Zabbix Developer

            Comment

            • zipitup
              Junior Member
              • Dec 2006
              • 9

              #7
              Thanks krelac.

              Comment

              • Palmertree
                Senior Member
                • Sep 2005
                • 746

                #8
                James Well very nice patch. I especially like all the new colors in the graphs and the acknoledgements. :-) I hope these tweaks and patches are integrated into next release of Zabbix.


                Here are all the new colors this patch will give you:
                + "Grey" => array(84,84,84),
                + "Slate Grey" => array(112,128,144),
                + "Black" => array(0,0,0),
                + "Blue Violet" => array(138,43,226),
                + "Cadet Blue" => array(95,159,159),
                + "Cornflower Blue" => array(100,149,237),
                + "Dodge Blue" => array(0,191,255),
                + "Blue" => array(0,0,255),
                + "Dark Blue" => array(0,0,150),
                + "Slate Blue" => array(106,90,205),
                + "Steel Blue" => array(70,130,180),
                + "Cyan" => array(0,255,255),
                + "Midnight Blue" => array(47,47,79),
                + "Saddle Brown" => array(139,69,19),
                + "Sandy Brown" => array(244,164,96),
                + "Brown" => array(210,105,30),
                + "Tan Brown" => array(151,105,79),
                + "Dark Green" => array(0,100,0),
                + "Grass Green" => array(124,252,0),
                + "Lime Green" => array(50,205,50),
                + "Olive Green" => array(107,142,35),
                + "Sea Green" => array(84,255,159),
                + "Chartreuse" => array(127,255,159),
                + "Green" => array(0,255,0),
                + "Dark Green" => array(0,150,0),
                + "Khaki" => array(240,230,140),
                + "Dark Orange" => array(255,140,0),
                + "Peach" => array(255,218,185),
                + "Coral" => array(240,128,128),
                + "Orange" => array(255,165,0),
                + "Mandarian Orange" => array(142,35,35),
                + "Dark Pink" => array(255,20,147),
                + "Hot Pink" => array(255,105,180),
                + "Indian Red" => array(205,92,92),
                + "Violet Red" => array(199,21,133),
                + "Orange Red" => array(255,69,0),
                + "Fire Brick" => array(178,34,34),
                + "Red" => array(255,0,0),
                + "Dark Red" => array(150,0,0),
                + "Spicy Pink" => array(255,28,174),
                "White" => array(255,255,255),
                + "Yellow" => array(255,255,0),
                + "Dark Yellow" => array(150,150,0),
                Last edited by Palmertree; 10-02-2007, 23:34.

                Comment

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

                  #9
                  FYI ZABBIX 1.3.x (1.4) supports flexible RGB-style colors with nice selection of colors. Old-syle colors are supported as well.
                  Alexei Vladishev
                  Creator of Zabbix, Product manager
                  New York | Tokyo | Riga
                  My Twitter

                  Comment

                  • Palmertree
                    Senior Member
                    • Sep 2005
                    • 746

                    #10
                    Thanks for the info Alex. :-)

                    Comment

                    • Palmertree
                      Senior Member
                      • Sep 2005
                      • 746

                      #11
                      I had to modifiy the forms.inc.php file for the housekeeping update. I was getting a SQL error for the variable ackduration= when updating the hosekeeper screeen for the "events" and "actions". Add "$frmHouseKeep->AddVar("ackduration",$config["ackduration"]);" to both functions "insert_housekeeper_form" and "insert_work_period_form()".


                      Code:
                             function        insert_housekeeper_form()
                              {
                                      $config=select_config();
                      
                                      $frmHouseKeep = new CFormTable(S_HOUSEKEEPER,"config.php");
                                      $frmHouseKeep->SetHelp("web.config.housekeeper.php");
                                      $frmHouseKeep->AddVar("config",get_request("config",0));
                                      $frmHouseKeep->AddVar("refresh_unsupported",$config["refresh_unsupported"]);
                                      $frmHouseKeep->AddVar("work_period",$config["work_period"]);
                                      $frmHouseKeep->AddVar("ackduration",$config["ackduration"]);
                                      $frmHouseKeep->AddRow(S_DO_NOT_KEEP_ACTIONS_OLDER_THAN,
                                              new CTextBox("alert_history",$config["alert_history"],8));
                                      $frmHouseKeep->AddRow(S_DO_NOT_KEEP_EVENTS_OLDER_THAN,
                                              new CTextBox("alarm_history",$config["alarm_history"],8));
                                      $frmHouseKeep->AddItemToBottomRow(new CButton("save",S_SAVE));
                                      $frmHouseKeep->Show();
                              }
                      
                              function        insert_work_period_form()
                              {
                                      $config=select_config();
                      
                                      $frmHouseKeep = new CFormTable(S_WORKING_TIME,"config.php");
                                      $frmHouseKeep->SetHelp("web.config.workperiod.php");
                                      $frmHouseKeep->AddVar("config",get_request("config",7));
                                      $frmHouseKeep->AddVar("alert_history",$config["alert_history"]);
                                      $frmHouseKeep->AddVar("alarm_history",$config["alarm_history"]);
                                      $frmHouseKeep->AddVar("refresh_unsupported",$config["refresh_unsupported"]);
                                      $frmHouseKeep->AddVar("ackduration",$config["ackduration"]);
                                      $frmHouseKeep->AddRow(S_WORKING_TIME,
                                              new CTextBox("work_period",$config["work_period"],35));
                                      $frmHouseKeep->AddItemToBottomRow(new CButton("save",S_SAVE));
                                      $frmHouseKeep->Show();
                              }
                      
                              function        insert_other_parameters_form()
                              {
                                      $config=select_config();
                      
                                      $frmHouseKeep = new CFormTable(S_OTHER_PARAMETERS,"config.php");
                                      $frmHouseKeep->SetHelp("web.config.other.php");
                                      $frmHouseKeep->AddVar("config",get_request("config",5));
                                      $frmHouseKeep->AddVar("alert_history",$config["alert_history"]);
                                      $frmHouseKeep->AddVar("alarm_history",$config["alarm_history"]);
                                      $frmHouseKeep->AddVar("work_period",$config["work_period"]);
                                      $frmHouseKeep->AddRow(S_REFRESH_UNSUPPORTED_ITEMS,
                                              new CTextBox("refresh_unsupported",$config["refresh_unsupported"],8));
                                      $frmHouseKeep->AddRow(S_ACKNOWLEDGE_DURATION,
                                              new CTextBox("ackduration",$config["ackduration"],8));
                                      $frmHouseKeep->AddItemToBottomRow(new CButton("save",S_SAVE));
                                      $frmHouseKeep->Show();
                              }
                      I also modified the config.inc.php file for the SQL string:

                      Code:
                              function        update_config($alarm_history,$alert_history,$refresh_unsupported,$work_period,$ackduration)
                              {
                                      if(!check_right("Configuration of Zabbix","U",0))
                                      {
                                              error("Insufficient permissions");
                                              return  0;
                                      }
                                      if(validate_period($work_period) != 0)
                                      {
                                              error("Icorrect work period");
                                              return NULL;
                                      }
                      
                      
                      //              $sql="update config set smtp_server='$smtp_server',smtp_helo='$smtp_helo',smtp_email='$smtp_email',alarm_history=$alarm_history,alert_history=$alert_history";
                                      $sql="update config set alarm_history=$alarm_history,alert_history=$alert_history,refresh_unsupported=$refresh_unsupported,ackduration=$ackduration,".
                                              "work_period=".zbx_dbstr($work_period);
                                      return  DBexecute($sql);
                              }
                      Last edited by Palmertree; 11-02-2007, 23:02.

                      Comment

                      • James Wells
                        Senior Member
                        • Jun 2005
                        • 664

                        #12
                        Attached is the bulk patch against 1.1.6, along with a couple of new features, trigger functions and a new screen widget. Please note that this bulk patch also includes a partial implementation of a PDF report generation system that I am working on.

                        EDIT: Updated patch to cover issues found by Palmertree and Krelac.
                        Attached Files
                        Last edited by James Wells; 19-02-2007, 23:56.
                        Unofficial Zabbix Developer

                        Comment

                        • krelac
                          Junior Member
                          • Oct 2006
                          • 24

                          #13
                          Originally posted by James Wells
                          Attached is the bulk patch against 1.1.6, along with a couple of new features, trigger functions and a new screen widget. Please note that this bulk patch also includes a partial implementation of a PDF report generation system that I am working on.

                          patch is applaying correctly to 1.1.6 but compile is failing

                          make[3]: Entering directory `/usr/local/src/zabbix_current/src/zabbix_server'
                          if gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/usr/include/mysql -I/usr/include -g -O2 -MT evalfunc.o -MD -MP -MF ".deps/evalfunc.Tpo" -c -o evalfunc.o evalfunc.c; \
                          then mv -f ".deps/evalfunc.Tpo" ".deps/evalfunc.Po"; else rm -f ".deps/evalfunc.Tpo"; exit 1; fi
                          evalfunc.c: In function `evaluate_AVGTD':
                          evalfunc.c:833: error: syntax error before ';' token
                          evalfunc.c:843: error: `yesterday_end' undeclared (first use in this function)
                          evalfunc.c:843: error: (Each undeclared identifier is reported only once
                          evalfunc.c:843: error: for each function it appears in.)
                          evalfunc.c: In function `evaluate_MINTD':
                          evalfunc.c:936: error: `yesterday_end' undeclared (first use in this function)
                          evalfunc.c:937: error: `yesteday_end' undeclared (first use in this function)
                          evalfunc.c: In function `evaluate_MAXTD':
                          evalfunc.c:1067: error: `yesterday_end' undeclared (first use in this function)
                          evalfunc.c:1068: error: `yesteday_end' undeclared (first use in this function)
                          make[3]: *** [evalfunc.o] Error 1
                          make[3]: Leaving directory `/usr/local/src/zabbix_current/src/zabbix_server'
                          make[2]: *** [all-recursive] Error 1
                          make[2]: Leaving directory `/usr/local/src/zabbix_current/src/zabbix_server'
                          make[1]: *** [all-recursive] Error 1
                          make[1]: Leaving directory `/usr/local/src/zabbix_current/src'
                          make: *** [all-recursive] Error


                          any idea?

                          Comment

                          • James Wells
                            Senior Member
                            • Jun 2005
                            • 664

                            #14
                            Yeah, I had a minor typo in the development version that I missed when I create the patch. Will post a corrected version as soon as I get it finished. I have completely re-written those functions anyway to better support future growth. To take advantage of the new functions, please replace zabbix/src/zabbix_server/evalfunc.c with the one from the zabbix download and then apply the PATCH: Temporal Displacement, 3 new trigger funcs.

                            Please note that the remainder (Everything but the evalfunc.c file) that the patch, is not quite compatible with the the bulk patch as of yet, I will be posting the corrected version shortly.
                            Last edited by James Wells; 19-02-2007, 23:50.
                            Unofficial Zabbix Developer

                            Comment

                            • James Wells
                              Senior Member
                              • Jun 2005
                              • 664

                              #15
                              Okay, here is the current version, which corrects the issue that Palmertree and Krelac found
                              Attached Files
                              Unofficial Zabbix Developer

                              Comment

                              Working...