From: Florian G. <re...@us...> - 2006-09-13 20:30:08
|
Update of /cvsroot/perfparse/_perfparse-phpgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12600 Modified Files: perfparse.php utils.php Log Message: select_metric input mask finished rework Index: utils.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/utils.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** utils.php 13 Sep 2006 15:22:36 -0000 1.24 --- utils.php 13 Sep 2006 20:30:03 -0000 1.25 *************** *** 129,133 **** $query='SELECT host_id,host_name FROM perfdata_host '; $query.='WHERE host_id in ('.str_repeat('?,',$n_hids-1).'?)'; ! echo $query; //debug $ret=$db->GetAssoc($query,$hostId); return($ret); --- 129,133 ---- $query='SELECT host_id,host_name FROM perfdata_host '; $query.='WHERE host_id in ('.str_repeat('?,',$n_hids-1).'?)'; ! // echo $query; //debug $ret=$db->GetAssoc($query,$hostId); return($ret); *************** *** 194,198 **** function get_metrics_from_hostid(&$db,$host_id) { ! $query ='SELECT s.service_description,m.metric FROM '; $query.='perfdata_service_metric m, perfdata_service s '; $query.='WHERE s.service_id=m.service_id AND s.host_id=? '; --- 194,199 ---- function get_metrics_from_hostid(&$db,$host_id) { ! $query ='SELECT s.service_description, s.service_id, '; ! $query.='m.metric, m.metric_id FROM '; $query.='perfdata_service_metric m, perfdata_service s '; $query.='WHERE s.service_id=m.service_id AND s.host_id=? '; *************** *** 202,206 **** if($res) { while($t=$res->FetchRow()) { ! $ret[$t['service_description']][]=$t['metric']; } } else { --- 203,208 ---- if($res) { while($t=$res->FetchRow()) { ! $ret[$t['service_id']][$t['metric_id']]=$t['metric']; ! $ret[$t['service_id']]['service_description']=$t['service_description']; } } else { Index: perfparse.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/perfparse.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** perfparse.php 13 Sep 2006 15:22:36 -0000 1.33 --- perfparse.php 13 Sep 2006 20:30:03 -0000 1.34 *************** *** 54,58 **** // php-perfparse version ! $smarty->assign('version','perfparse 0.106.1 php-perfparse v.04'); // Parse perfparse.conf to get database variables --- 54,58 ---- // php-perfparse version ! $smarty->assign('version','perfparse 0.106.1 php-perfparse v.05'); // Parse perfparse.conf to get database variables *************** *** 173,192 **** $hidnames=get_hostname_from_id($db,$host_id); ! echo "<pre>metrics:\n"; print_r($metrics); echo "</pre>"; ! echo "<pre>hidnames:\n"; print_r($hidnames); echo "</pre>"; $smarty->assign_by_ref('metrics',$metrics); // find all metrics that more than one host own // used for selecting all metrics of a type via js $diffmetrics=array(); foreach($metrics as $hostId => $servicearray) { ! foreach($servicearray as $service => $metricarray) { ! foreach($metricarray as $metric ) { ! $diffmetrics[$service][$metric]["hostids"][]=$hostId; ! $diffmetrics[$service][$metric]["count"]=count($diffmetrics[$service][$metric]["hostids"]); } } } ! echo "diffmetrics array:<br /><pre>"; print_r($diffmetrics); echo "</pre>"; $smarty->assign_by_ref('diffmetrics',$diffmetrics); --- 173,197 ---- $hidnames=get_hostname_from_id($db,$host_id); ! // echo "<pre>metrics:\n"; print_r($metrics); echo "</pre>"; ! // echo "<pre>hidnames:\n"; print_r($hidnames); echo "</pre>"; $smarty->assign_by_ref('metrics',$metrics); + $smarty->assign_by_ref('hidnames',$hidnames); // find all metrics that more than one host own // used for selecting all metrics of a type via js $diffmetrics=array(); foreach($metrics as $hostId => $servicearray) { ! foreach($servicearray as $serviceid => $metricarray) { ! $diffmetrics[$serviceid]['service_description']=$metricarray['service_description']; ! foreach($metricarray as $metricid=>$metric ) { ! if($metricid != 'service_description'){ ! $diffmetrics[$serviceid][$metricid]["hosts"][$hostId]=$hidnames[$hostId]; ! $diffmetrics[$serviceid][$metricid]["metric_name"]=$metric; ! $diffmetrics[$serviceid][$metricid]["count"]=count($diffmetrics[$serviceid][$metricid]["hosts"]); ! } } } } ! // echo "diffmetrics array:<br /><pre>"; print_r($diffmetrics); echo "</pre>"; $smarty->assign_by_ref('diffmetrics',$diffmetrics); |