Update of /cvsroot/perfparse/_perfparse-phpgui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14205
Modified Files:
perfparse.php utils.php
Log Message:
group_id=0 means all groups
Index: utils.php
===================================================================
RCS file: /cvsroot/perfparse/_perfparse-phpgui/utils.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** utils.php 9 Nov 2006 16:02:50 -0000 1.28
--- utils.php 10 Nov 2006 14:53:28 -0000 1.29
***************
*** 280,284 ****
! // 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) {
--- 280,285 ----
! // get all metrics and the metric details for all hosts of a given group Id.
! // if group id is 0 then return results from all groups
// $sort defines the sort order of the resulting array
function get_groupId_host_metrics(&$db,$groupId,$sort) {
***************
*** 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');
--- 293,315 ----
$sorts[1]='asc';
}
+
+ // build query
$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 ';
! // group_id==0 means all groups
! if ($groupId == 0) {
! $query.=' WHERE ';
! $bindarray=array();
! } else {
! $query.=', perfdata_host_groups hg WHERE ';
! $query.='hg.group_id=? AND hg.host_id=h.host_id AND ';
! $bindarray=array($groupId);
! }
$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];
!
! // do the query
! $res=$db->Execute($query,$bindarray);
$ret=array();
$statearray=array('OK','WARNING','CRITICAL','UNKNOWN');
***************
*** 332,335 ****
--- 344,348 ----
die();
}
+ //echo "<pre>in ".__FILE__." line ".__LINE__." function ".__FUNCTION__.":\n";print_r($ret);echo "</pre>";
return($ret);
}
Index: perfparse.php
===================================================================
RCS file: /cvsroot/perfparse/_perfparse-phpgui/perfparse.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** perfparse.php 9 Nov 2006 16:02:50 -0000 1.40
--- perfparse.php 10 Nov 2006 14:53:28 -0000 1.41
***************
*** 365,369 ****
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');
--- 365,370 ----
get_request_var('refresh','int',0); // todo implement refresh
! if(get_request_var('group_id','int','-1') &&
! (array_key_exists($group_id,$groups) || $group_id == 0)) {
get_request_var('sort','string','host_name.desc');
|