-- DBA create the database and give access permissions.
--
-- $Log: create.sql,v $
--- Revision 1.8 2003-02-08 07:36:41 arjen
+-- Revision 1.9 2003-02-13 08:46:54 arjen
+-- Added log, notification and parameter counters to the 'object' table.
+-- Counting these things at the time a user interface needs them is
+-- too slow. Other programs, like gcm_daemon en gcm_input should prepare
+-- these counters for quick retrieval.
+--
+-- Revision 1.8 2003/02/08 07:36:41 arjen
-- Added new table to the database : log_adv_daemon
--
-- Revision 1.7 2003/02/05 09:29:08 arjen
COPY "db_value" FROM stdin;
-db_version 21
+db_version 28
gcm_daemon_version 1
log_processing 0
+last_notification 0
\.
--
"timezone" text,
"remark" text,
"os" text,
- "os_version" text
+ "os_version" text,
+ "log_count" bigint,
+ "notification_count" bigint,
+ "parameter_count" bigint
);
CREATE UNIQUE INDEX object_objectid_key ON object USING btree (objectid);
COPY "type_of_issue" FROM stdin;
1 manual entry 4 A manual entry of a notification t
2 parameter created 3 A new parameter was created t
-3 property modified 3 The STATIC property of a parameter was modified t
+3 property modified 3 The STATIC property of a parameter was modified t
4 parameter removed 3 A parameter was removed t
\.
***********************
** FILE NAME : objects.php
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.3 $
+** VERSION NUMBER : $Revision: 1.4 $
**
** DESCRIPTION : Objects Administration page.
** Input parameters: action (POST) : empty, 'Create'
/*****************************
$Log: objects.php,v $
- Revision 1.3 2003-02-10 15:42:24 arjen
+ Revision 1.4 2003-02-13 08:48:23 arjen
+ Added log, notification and parameter counters to the 'object' table.
+ Counting these things at the time a user interface needs them is
+ too slow. Other programs, like gcm_daemon en gcm_input should prepare
+ these counters for quick retrieval.
+
+ Revision 1.3 2003/02/10 15:42:24 arjen
Show the total number of Log entries, parameters and notifications
Revision 1.2 2003/02/05 09:48:14 arjen
******************************/
-// RCSID = "$Id: objects.php,v 1.3 2003-02-10 15:42:24 arjen Exp $";
+// RCSID = "$Id: objects.php,v 1.4 2003-02-13 08:48:23 arjen Exp $";
session_start();
require_once('classes/gnucomo_config.php');
if (isset($_POST['action']) && $_POST['action'] == 'Create' && !empty($_POST['objectname']))
{
- pg_exec($conn, "INSERT INTO object (objectname) VALUES ('"
- . $_POST['objectname'] . "')");
+ pg_exec($conn, "INSERT INTO object (objectname, log_count, parameter_count, notification_count) VALUES ('"
+ . $_POST['objectname'] . "', '0', '0', '0')");
}
if (isset($_POST['action']) && $_POST['action'] == 'Remove' && !empty($_POST['objectname']))
pg_exec($conn, "DELETE FROM object WHERE objectname='" . $_POST['objectname'] . "'");
}
- $res = pg_exec($conn, "SELECT objectid,objectname FROM object");
+ $res = pg_exec($conn, "SELECT objectid,objectname, log_count, notification_count FROM object ORDER BY objectname");
echo "<table>";
$obj = 0;
while ($obj < pg_numrows($res))
{
$u = pg_fetch_object($res, $obj);
- $r = pg_exec($conn, "SELECT count(logid) FROM log WHERE objectid='"
- . $u->objectid . "'");
- $r = pg_fetch_object($r, 0);
-
- $nr_logs = $r->count;
+ $nr_logs = $u->log_count;
$count_logs = $count_logs + $nr_logs;
$r = pg_exec ($conn, "SELECT count(paramid) FROM parameter WHERE objectid='"
$nr_params = $r->count;
$count_parameters = $count_parameters + $nr_params;
- $r = pg_exec ($conn, "SELECT count(notificationid) FROM notification WHERE objectid='"
- . $u->objectid . "'");
- $r = pg_fetch_object($r, 0);
-
- $nr_notifications = $r->count;
+ $nr_notifications = $u->notification_count;
$count_notifications = $count_notifications + $nr_notifications;
?>
<tr><td align='center'><img src='server.png'><br>
<b><?php echo $u->objectname ?></b>
- </td><td>
+ </td><td align='right'>
<?php echo $nr_logs?> <a href='log.php?oid=<?php echo $u->objectid?>'>Log entries</a>
</td><td>
<?php echo $nr_params?> <a href='parameter.php?oid=<?php echo $u->objectid?>'>Parameters</a>