Changeset 5b508a1274eabf41cc517df3d0fa2c0070868ad6
- Timestamp:
- 07/12/08 15:13:06
(5 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
| r5bd9db1 |
r5b508a1 |
|
| 41 | 41 | } |
|---|
| 42 | 42 | $jitem = array('id' => $item['id'], |
|---|
| 43 | | 'text' => $item[$want], |
|---|
| | 43 | 'text' => $item['ptr'] ? |
|---|
| | 44 | $item[$want] . "(" . $item['ptr'] . ")" : |
|---|
| | 45 | $item[$want], |
|---|
| 44 | 46 | 'classes' => $want, |
|---|
| 45 | 47 | 'hasChildren' => $item['unique'] ? false : true, |
|---|
| r5bd9db1 |
r5b508a1 |
|
| 69 | 69 | foreach($vars as $var) { |
|---|
| 70 | 70 | if(isset($fixate[$var])) { |
|---|
| 71 | | $where_sql .= " and $var = ?"; |
|---|
| | 71 | $where_sql .= " and c.$var = ?"; |
|---|
| 72 | 72 | $binds[] = $fixate[$var]; |
|---|
| 73 | 73 | $named_binds[$var] = $fixate[$var]; |
|---|
| 74 | 74 | } |
|---|
| 75 | 75 | } |
|---|
| | 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 | } |
|---|
| 76 | 89 | $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 |
|---|
| 78 | 93 | from stratcon.mv_loading_dock_check_s c |
|---|
| 79 | 94 | join stratcon.metric_name_summary m using (sid) |
|---|
| | 95 | $ptr_join |
|---|
| 80 | 96 | 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"; |
|---|
| 83 | 99 | $sth = $this->db->prepare($sql); |
|---|
| 84 | 100 | $sth->execute($binds); |
|---|
| … | … | |
| 93 | 109 | } |
|---|
| 94 | 110 | $copy['cnt'] = $row['cnt']; |
|---|
| | 111 | if(isset($row['ptr'])) $copy['ptr'] = $row['ptr']; |
|---|
| 95 | 112 | if($copy['cnt'] == 1 && |
|---|
| 96 | 113 | isset($row['sid']) && |
|---|