Changeset 5b508a1274eabf41cc517df3d0fa2c0070868ad6

Show
Ignore:
Timestamp:
07/12/08 15:13:06 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1215875586 +0000
git-parent:

[1a995b1bda169392d8d493a8214d2a13fa053616]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1215875586 +0000
Message:

incorporate auto-magic in-addr.arpa identification

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ui/web/htdocs/ds_json.php

    r5bd9db1 r5b508a1  
    4141    } 
    4242    $jitem = array('id'          => $item['id'], 
    43                    'text'        => $item[$want], 
     43                   'text'        => $item['ptr'] ? 
     44                                      $item[$want] . "(" . $item['ptr'] . ")" : 
     45                                      $item[$want], 
    4446                   'classes'     => $want, 
    4547                   'hasChildren' => $item['unique'] ? false : true, 
  • ui/web/lib/Reconnoiter_DB.php

    r5bd9db1 r5b508a1  
    6969    foreach($vars as $var) { 
    7070      if(isset($fixate[$var])) { 
    71         $where_sql .= " and $var = ?"; 
     71        $where_sql .= " and c.$var = ?"; 
    7272        $binds[] = $fixate[$var]; 
    7373        $named_binds[$var] = $fixate[$var]; 
    7474      } 
    7575    } 
     76    $ptr_select = ''; 
     77    $ptr_groupby = ''; 
     78    $ptr_join = ''; 
     79    if($want == 'target' || $want == 'remote_address') { 
     80      $ptr_select = 'ciamt.value as ptr, '; 
     81      $ptr_groupby = ', ciamt.value'; 
     82      $ptr_join = " 
     83        left join stratcon.mv_loading_dock_check_s cia 
     84               on (    c.$want ::inet = cia.target ::inet 
     85                   and cia.module='dns' and cia.name='in-addr.arpa') 
     86        left join stratcon.current_metric_text ciamt 
     87               on (cia.sid = ciamt.sid and ciamt.name='answer')"; 
     88    } 
    7689    $sql = " 
    77       select $want, min(sid) as sid, min(metric_type) as metric_type, count(1) as cnt 
     90      select c.$want, $ptr_select 
     91             min(c.sid) as sid, min(metric_type) as metric_type, 
     92             count(1) as cnt 
    7893        from stratcon.mv_loading_dock_check_s c 
    7994        join stratcon.metric_name_summary m using (sid) 
     95             $ptr_join 
    8096       where active = " . ($active ? "true" : "false") . $where_sql . " 
    81     group by $want 
    82     order by $want"; 
     97    group by c.$want $ptr_groupby 
     98    order by c.$want"; 
    8399    $sth = $this->db->prepare($sql); 
    84100    $sth->execute($binds); 
     
    93109      } 
    94110      $copy['cnt'] = $row['cnt']; 
     111      if(isset($row['ptr'])) $copy['ptr'] = $row['ptr']; 
    95112      if($copy['cnt'] == 1 && 
    96113         isset($row['sid']) &&