From: Florian G. <re...@us...> - 2007-06-05 22:47:00
|
Update of /cvsroot/perfparse/_perfparse-phpgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10151/phpgui Modified Files: perfparse.php utils.php Log Message: continue database conversion Index: utils.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/utils.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** utils.php 1 Jun 2007 10:54:04 -0000 1.35 --- utils.php 5 Jun 2007 22:46:59 -0000 1.36 *************** *** 339,342 **** --- 339,343 ---- 'service_description_url' => $t['service_description'], 'metric' => $t['metric'], + 'metric_id' => $t['metric_id'], 'ctime' => $t['ctime'], 'value' => $t['value'], *************** *** 365,369 **** } ! function get_group_raw(&$db,$group,$sort,$normal,$warning,$critical,$unknown) { $statearray=array('OK','WARNING','CRITICAL','UNKNOWN'); // sort order. set default sort order to escape maicious input --- 366,370 ---- } ! function get_group_raw(&$db,$group_id,$sort,$normal,$warning,$critical,$unknown) { $statearray=array('OK','WARNING','CRITICAL','UNKNOWN'); // sort order. set default sort order to escape maicious input *************** *** 377,386 **** } ! $query ='SELECT h.host_name, s.service_description, r.ctime, r.txt_data, nagios_status, s.service_id '; ! $query.='FROM perfdata_service s, perfdata_service_raw r, perfdata_host h, perfdata_host_groups hg, perfdata_groups g '; ! $query.='WHERE g.group_name=? and g.group_id=hg.group_id and hg.host_id=h.host_id and h.host_id=s.host_id and r.id = s.last_perfdata_raw'; ! $bindvars=array($group); if($normal==false || $warning==false || $critical==false || $unknown==false) { ! $query.='AND nagios_status in ('; $interieur=array(); if($normal==true) {$interieur[]='?'; $bindvars[]=0;} --- 378,395 ---- } ! if($group_id>0) { ! $query ='SELECT h.host_name, s.service_description, r.ctime, r.txt_data, nagios_status, s.service_id '; ! $query.='FROM perfdata_service s, perfdata_service_raw r, perfdata_host h, perfdata_host_groups hg, perfdata_groups g '; ! $query.='WHERE hg.group_id=? and g.group_id=hg.group_id and hg.host_id=h.host_id and h.host_id=s.host_id and r.id = s.last_perfdata_raw'; ! $bindvars=array($group_id); ! } else { ! $query ='SELECT h.host_name, s.service_description, r.ctime, r.txt_data, nagios_status, s.service_id '; ! $query.='FROM perfdata_service s, perfdata_service_raw r, perfdata_host h '; ! $query.='WHERE h.host_id=s.host_id and r.id = s.last_perfdata_raw'; ! $bindvars=array(); ! } ! if($normal==false || $warning==false || $critical==false || $unknown==false) { ! $query.=' AND nagios_status in ('; $interieur=array(); if($normal==true) {$interieur[]='?'; $bindvars[]=0;} *************** *** 391,395 **** } ! $query.='order by '.$sorts[0].' '.$sorts[1]; $res=$db->Execute($query,$bindvars); $ret=array(); --- 400,406 ---- } ! $query.=' order by '.$sorts[0].' '.$sorts[1]; ! // print($query); ! $res=$db->Execute($query,$bindvars); $ret=array(); Index: perfparse.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/perfparse.php,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** perfparse.php 1 Jun 2007 10:54:03 -0000 1.46 --- perfparse.php 5 Jun 2007 22:46:59 -0000 1.47 *************** *** 374,378 **** $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); $smarty->assign_by_ref('groupraw',$groupraw); } --- 374,378 ---- $smarty->assign_by_ref('groupmetrics',$groupmetrics); // todo: continue here db schema conversion } else { ! $groupraw=get_group_raw($db,$group_id,$sort,$normal,$warning,$critical,$unknown); $smarty->assign_by_ref('groupraw',$groupraw); } |