]> git.pld-linux.org Git - packages/cacti.git/commitdiff
- patches for cacti-0.8.7a
authorGrzegorz Sterniczuk <grzegorz@sterniczuk.eu>
Wed, 5 Dec 2007 07:47:19 +0000 (07:47 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cmd-php-non-unique-hosts.patch -> 1.1
    graph-issue-wrra-specs.patch -> 1.1

cmd-php-non-unique-hosts.patch [new file with mode: 0644]
graph-issue-wrra-specs.patch [new file with mode: 0644]

diff --git a/cmd-php-non-unique-hosts.patch b/cmd-php-non-unique-hosts.patch
new file mode 100644 (file)
index 0000000..01d8a70
--- /dev/null
@@ -0,0 +1,13 @@
+--- cacti/cmd.php      2007/11/03 23:03:30     4297
++++ cacti/cmd.php      2007/11/26 01:34:11     4355
+@@ -201,8 +201,8 @@
+       }
+       foreach ($polling_items as $item) {
+-              $data_source = $item["local_data_id"];
+-              $current_host = $item["hostname"];
++              $data_source  = $item["local_data_id"];
++              $current_host = $item["host_id"];
+               if ($current_host != $last_host) {
+                       $new_host = true;
diff --git a/graph-issue-wrra-specs.patch b/graph-issue-wrra-specs.patch
new file mode 100644 (file)
index 0000000..902d1ab
--- /dev/null
@@ -0,0 +1,106 @@
+--- cacti/lib/functions.php    2007/11/16 03:33:22     4350
++++ cacti/lib/functions.php    2007/11/19 02:21:59     4351
+@@ -1077,27 +1077,19 @@
+     @returns - the best cf to use */
+ function generate_graph_best_cf($local_data_id, $requested_cf) {
+       if ($local_data_id > 0) {
+-              $avail_cf_functions = db_fetch_assoc("SELECT DISTINCT
+-                      rra_cf.consolidation_function_id AS rra_cf
+-                      FROM (data_template_data
+-                      INNER JOIN data_template_data_rra ON data_template_data.id=data_template_data_rra.data_template_data_id)
+-                      INNER JOIN (rra INNER JOIN rra_cf ON rra.id=rra_cf.rra_id) ON data_template_data_rra.rra_id=rra.id
+-                      WHERE data_template_data.local_data_id=$local_data_id
+-                      ORDER BY rra_cf ASC");
++              $avail_cf_functions = get_rrd_cfs($local_data_id);
+               /* workaround until we hae RRA presets in 0.8.8 */
+-              if ($requested_cf != 4) {
+-                      if (sizeof($avail_cf_functions)) {
+-                              /* check through the cf's and get the best */
+-                              foreach($avail_cf_functions as $cf) {
+-                                      if ($cf["rra_cf"] == $requested_cf) {
+-                                              return $requested_cf;
+-                                      }
++              if (sizeof($avail_cf_functions)) {
++                      /* check through the cf's and get the best */
++                      foreach($avail_cf_functions as $cf) {
++                              if ($cf["rra_cf"] == $requested_cf) {
++                                      return $requested_cf;
+                               }
+-
+-                              /* if none was found, take the first */
+-                              return $avail_cf_functions[0]["rra_cf"];
+                       }
++
++                      /* if none was found, take the first */
++                      return $avail_cf_functions[0]["rra_cf"];
+               }
+       }
+@@ -1105,6 +1097,66 @@
+       return "1";
+ }
++/* get_rrd_cfs - reads the RRDfile and get's the RRA's stored in it.
++    @arg $local_data_id
++    @returns - array of the CF functions */
++function get_rrd_cfs($local_data_id) {
++      global $rrd_cfs;
++
++      $rrdfile = get_data_source_path($local_data_id, TRUE);
++
++      if (!isset($rrd_cfs)) {
++              $rrd_cfs = array();
++      }else if (array_key_exists($local_data_id, $rrd_cfs)) {
++              return $rrd_cfs[$local_data_id];
++      }
++
++      $cfs = array();
++
++      $output = rrdtool_execute("info $rrdfile", FALSE, RRDTOOL_OUTPUT_STDOUT);
++
++      if (strlen($output)) {
++              $output = explode("\n", $output);
++
++              if (sizeof($output)) {
++              foreach($output as $line) {
++                      if (substr_count($line, ".cf")) {
++                              $values = explode("=",$line);
++
++                              if (!in_array(trim($values[1]), $cfs)) {
++                                      $cfs[] = trim($values[1]);
++                              }
++                      }
++              }
++              }
++      }
++
++      $new_cfs = array();
++
++      if (sizeof($cfs)) {
++      foreach($cfs as $cf) {
++              switch($cf) {
++              case "AVG":
++                      $new_cfs[] = 1;
++                      break;
++              case "MIN":
++                      $new_cfs[] = 2;
++                      break;
++              case "MAX":
++                      $new_cfs[] = 3;
++                      break;
++              case "LAST":
++                      $new_cfs[] = 3;
++                      break;
++              }
++      }
++      }
++
++      $rrd_cfs[$local_data_id] = $new_cfs;
++
++      return $new_cfs;
++}
++
+ /* generate_graph_def_name - takes a number and turns each digit into its letter-based
+      counterpart for RRDTool DEF names (ex 1 -> a, 2 -> b, etc)
+    @arg $graph_item_id - (int) the ID to generate a letter-based representation of
This page took 0.136966 seconds and 4 git commands to generate.