From: Florian G. <re...@us...> - 2006-11-09 16:03:06
|
Update of /cvsroot/perfparse/_perfparse-phpgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv341 Modified Files: perfparse.php utils.php Log Message: more db schema conversion Index: utils.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/utils.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** utils.php 9 Nov 2006 12:53:01 -0000 1.27 --- utils.php 9 Nov 2006 16:02:50 -0000 1.28 *************** *** 280,284 **** ! function get_group_host_metrics(&$db,$group,$sort) { // sort order. set default sort order to escape maicious input $sorts=explode('.',$sort); --- 280,286 ---- ! // get all metrics and the metric details for all hosts of a given group name. ! // $sort defines the sort order of the resulting array ! function get_groupId_host_metrics(&$db,$groupId,$sort) { // sort order. set default sort order to escape maicious input $sorts=explode('.',$sort); *************** *** 290,308 **** $sorts[1]='asc'; } ! /* original query ! SELECT perfdata_host.host_name, perfdata_service.service_description, perfdata_service_metric.metric, perfdata_service_metric.unit, perfdata_service_bin.value, perfdata_service_bin.state, perfdata_service_bin.ctime" ! " FROM perfdata_host, perfdata_service, perfdata_service_metric, perfdata_service_bin" ! " WHERE perfdata_host.host_name = perfdata_service.host_name" ! " AND perfdata_service_metric.host_name = perfdata_service.host_name" ! " AND perfdata_service_metric.service_description = perfdata_service.service_description" ! " AND perfdata_service_bin.id = perfdata_service_metric.last_perfdata_bin" ! */ ! $query ='SELECT h.host_name,m.service_description,m.metric,b.ctime,value,m.unit,state from '; ! $query.='perfdata_service_metric m, perfdata_host h,perfdata_service_bin b '; ! $query.='WHERE '; ! $query.='m.host_name=h.host_name and m.host_name=b.host_name and '; ! $query.='m.last_perfdata_bin=b.id and h.group_name=? '; $query.='order by '.$sorts[0].' '.$sorts[1]; ! $res=$db->Execute($query,array($group)); $ret=array(); $statearray=array('OK','WARNING','CRITICAL','UNKNOWN'); --- 292,303 ---- $sorts[1]='asc'; } ! $query ='SELECT h.host_name,s.service_description,m.metric,b.ctime,value,m.unit,b.state from '; ! $query.='perfdata_service_metric m, perfdata_host h,perfdata_service_bin b, perfdata_service s, '; ! $query.='perfdata_host_groups hg WHERE '; ! $query.='hg.group_id=? AND hg.host_id=h.host_id AND '; ! $query.='h.host_id=s.host_id AND s.service_id=m.service_id AND '; ! $query.='m.last_perfdata_bin=b.id '; $query.='order by '.$sorts[0].' '.$sorts[1]; ! $res=$db->Execute($query,array($groupId)); $ret=array(); $statearray=array('OK','WARNING','CRITICAL','UNKNOWN'); Index: perfparse.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/perfparse.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** perfparse.php 9 Nov 2006 12:53:01 -0000 1.39 --- perfparse.php 9 Nov 2006 16:02:50 -0000 1.40 *************** *** 365,375 **** get_request_var('refresh','int',0); // todo implement refresh ! if(get_request_var('group_name','string','') && in_array($group_name,$groups)) { get_request_var('sort','string','host_name.desc'); if ($page == 'all_bin') { ! $groupmetrics=get_group_host_metrics($db,$group_name,$sort); // echo"<pre>";print_r($groupmetrics);echo"</pre>"; ! $smarty->assign_by_ref('groupmetrics',$groupmetrics); } else { $groupraw=get_group_raw($db,$group_name,$sort,$normal,$warning,$critical,$unknown); --- 365,375 ---- get_request_var('refresh','int',0); // todo implement refresh ! if(get_request_var('group_id','int','-1') && array_key_exists($group_id,$groups)) { get_request_var('sort','string','host_name.desc'); if ($page == 'all_bin') { ! $groupmetrics=get_groupId_host_metrics($db,$group_id,$sort); // echo"<pre>";print_r($groupmetrics);echo"</pre>"; ! $smarty->assign_by_ref('groupmetrics',$groupmetrics); // todo: continue here db schema conversion } else { $groupraw=get_group_raw($db,$group_name,$sort,$normal,$warning,$critical,$unknown); |