From: arjen Date: Tue, 15 Jul 2003 11:02:25 +0000 (+0000) Subject: Use the new object_statistics table. X-Git-Tag: V0_0_6~4 X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=8a1c181490f98b6697f6d589935413af64f118cb Use the new object_statistics table. --- diff --git a/src/web/objects.php b/src/web/objects.php index e53e686..7222e7b 100644 --- a/src/web/objects.php +++ b/src/web/objects.php @@ -9,7 +9,7 @@ *********************** ** FILE NAME : objects.php ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.6 $ +** VERSION NUMBER : $Revision: 1.7 $ ** ** DESCRIPTION : Objects Administration page. ** Input parameters: action (POST) : empty, 'Create' @@ -29,7 +29,10 @@ /***************************** $Log: objects.php,v $ - Revision 1.6 2003-02-21 08:46:58 arjen + Revision 1.7 2003-07-15 11:02:25 arjen + Use the new object_statistics table. + + Revision 1.6 2003/02/21 08:46:58 arjen Improved the table layout. Revision 1.5 2003/02/13 09:01:29 arjen @@ -49,7 +52,7 @@ ******************************/ -// RCSID = "$Id: objects.php,v 1.6 2003-02-21 08:46:58 arjen Exp $"; +// RCSID = "$Id: objects.php,v 1.7 2003-07-15 11:02:25 arjen Exp $"; ini_set('include_path', '.:./classes:../phpclasses'); @@ -88,6 +91,45 @@ function CheckRemove(f) class object_page extends page { + var $nr_parameters, $removed_parameters; + var $nr_notifications, $closed_notifications; + var $nr_logs; + + function GatherStatistics($objectid) + { + // Gather statistics on parameters + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='parameters'"); + $stat = pg_fetch_object($r, 0); + $this->nr_parameters = $stat->statvalue; + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='removed_parameters'"); + $stat = pg_fetch_object($r, 0); + $this->removed_parameters = $stat->statvalue; + + // Gather statistics on notifications + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='notifications'"); + $stat = pg_fetch_object($r, 0); + $this->nr_notifications = $stat->statvalue; + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='closed_notifications'"); + $stat = pg_fetch_object($r, 0); + $this->closed_notifications = $stat->statvalue; + + // Gather statistics on log entries + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='logs'"); + $stat = pg_fetch_object($r, 0); + $this->nr_logs = $stat->statvalue; + + } + function Body() { clientscripts(); @@ -120,32 +162,33 @@ class object_page extends page //The counters are set to zero $count_logs = 0; $count_notifications = 0; + $closed_notifications = 0; $count_parameters = 0; + $removed_parameters = 0; while ($obj < pg_numrows($res)) { $u = pg_fetch_object($res, $obj); - $nr_logs = $u->log_count; - $count_logs = $count_logs + $nr_logs; - $r = pg_exec ($this->database, "SELECT count(paramid) FROM parameter WHERE objectid=CAST('" - . $u->objectid . "' AS BIGINT)"); - $r = pg_fetch_object($r, 0); + $this->GatherStatistics($u->objectid); - $nr_params = $r->count; - $count_parameters = $count_parameters + $nr_params; + $count_parameters += $this->nr_parameters; + $removed_parameters += $this->removed_parameters; + $count_logs = $count_logs + $this->nr_logs; - $nr_notifications = $u->notification_count; - $count_notifications = $count_notifications + $nr_notifications; + //$nr_notifications = $u->notification_count; + $count_notifications += $this->nr_notifications; + $closed_notifications += $this->closed_notifications; ?>

objectname ?>
- objectid'> $nr_logs " ?> + objectid'> $this->nr_logs " ?> - objectid'> $nr_params " ?> + objectid'>" . $this->nr_parameters + . " (" . $this->removed_parameters . " removed)" ?> - objectid'> $nr_notifications " ?> + objectid'>" . $this->nr_notifications . " (" . $this->closed_notifications . " closed)" ?>
@@ -159,8 +202,8 @@ class object_page extends page //Show the totals echo "

TOTALS
"; echo "$count_logs"; - echo "$count_parameters"; - echo "$count_notifications"; + echo "$count_parameters ($removed_parameters removed)"; + echo "$count_notifications ($closed_notifications closed)"; echo ""; ?> @@ -169,7 +212,7 @@ class object_page extends page

-Objects name (FQDN): +Object's name (FQDN):