File: tattle_autocomplete.php

package info (click to toggle)
ganglia-web 3.7.6%2Bdebian-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,368 kB
  • sloc: javascript: 27,575; php: 17,272; sh: 346; makefile: 82; xml: 42
file content (29 lines) | stat: -rw-r--r-- 700 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

require_once('./eval_conf.php');
require_once('./functions.php');

// Load the metric caching code
//$debug = 1;
retrieve_metrics_cache();

if ( isset($_GET['term']) && $_GET['term'] != "" ) {

  $query = $_GET['term'];
  // Now let's look through metrics.
  foreach ( $index_array['metrics'] as $metric_name => $hosts ) {
    if ( preg_match("/$query/i", $metric_name ) ) {
      foreach ( $hosts as $key => $host_name ) {
        $clusters = $index_array['cluster'][$host_name];
        foreach ($clusters as $cluster_name) {
          $results[] = array( "value" => $cluster_name . "_|_" . $host_name . "_|_" . $metric_name);
        }
      }
    }
  }

}

echo json_encode($results);

?>