public function find_sids($json)
 {
     $this->num_sids = 0;
     $sids = array();
     $vs = Reconnoiter_GraphTemplate::find_variables($json);
     //vs will be multiD array containing variable names, their types (text/sid) and metric
     //names and metric types
     foreach ($vs as $v => $d) {
         if (isset($d['SID'])) {
             $this->num_sids++;
             $sql = "select m.* from noit.check_currently as m";
             $binds = array();
             $t = 1;
             $sids[$v] = array();
             foreach ($d['SID'] as $m) {
                 $sql = "{$sql}\n                    join noit.metric_name_summary t{$t}\n                      on (    m.sid = t{$t}.sid\n                          and t{$t}.metric_name = ?\n                          and t{$t}.metric_type = ?)";
                 $binds[] = $m[0];
                 $binds[] = $m[1];
                 $t++;
             }
             if (count($binds)) {
                 $db = Reconnoiter_DB::getDB();
                 $sth = $db->prepare($sql);
                 $sth->execute($binds);
                 while ($row = $sth->fetch()) {
                     $sids[$v][] = $row;
                 }
             }
         }
     }
     return $sids;
 }