Gnucomo-0.0.3: December 6th 2002
$Log: gcm_daemon.php,v $
- Revision 1.14 2003-09-01 06:51:07 arjen
+ Revision 1.15 2003-09-02 12:48:09 arjen
+ BUGFIX: Secondary indices on log_notification were unique.
+ Additional information in the 'usr' table: 'display_name' and 'email'.
+ Added new issues and services.
+
+ Revision 1.14 2003/09/01 06:51:07 arjen
Accept command argument '-c config' to use an alternate
gnucomo configuration.
*/
-// $Id: gcm_daemon.php,v 1.14 2003-09-01 06:51:07 arjen Exp $
+// $Id: gcm_daemon.php,v 1.15 2003-09-02 12:48:09 arjen Exp $
ini_set('include_path', '.:./classes:../phpclasses');
ini_set('html_errors', 'false');
$project_name = "gnucomo"; // name of the entire project
$app_name = "gcm_daemon"; // name of the application running
$developrelease = "FALSE"; // Indicates if special debug settings are needed
-$db_version = 42; // The db_version indicates what the level of
+$db_version = 43; // The db_version indicates what the level of
// the database should be. If the database is
// old an update will be generated.
$gcmd_version = 5; // This value indicates the active version of
//At this place we start processing new log-lines
process_log ();
+ //service_check();
find_notifications();
$keep_running = false;
UpdateStatistic($objectid, 'logs', $cnt->count);
}
+/*
+ * Service_check - Check the log entries if there are any unknown
+ * services.
+ */
+
+function service_check()
+{
+ global $dbms;
+
+ $log_res = $dbms->query("SELECT objectid, servicecode,rawdata FROM log");
+
+ for ($log_row = 0; $log_row < $dbms->num_rows($log_res); $log_row++)
+ {
+ $log_entry = $dbms->fetch_object($log_res, $log_row);
+
+ // Check if the service is used on the object.
+
+ $qry = "SELECT * FROM object_service WHERE objectid='";
+ $qry .= $log_entry->objectid . "' AND servicecode='";
+ $qry .= $log_entry->servicecode . "'";
+
+ $os_res = $dbms->query($qry);
+ if ($dbms->num_rows($os_res) == 0)
+ {
+ // Service is not found for the object, check if the service
+ // exists at all.
-function find_notifications () {
+ $qry = "SELECT * FROM service WHERE servicecode='";
+ $qry .= $log_entry->servicecode . "'";
+
+ if ($dbms->num_rows($dbms->query($qry)) == 0)
+ {
+ echo "Service " . $log_entry->servicecode . " does not exist.\n";
+ }
+ else
+ {
+ $qry = "SELECT objectname FROM object WHERE objectid='";
+ $qry .= $log_entry->objectid . "'";
+ $object = $dbms->fetch_object($dbms->query($qry), 0);
+ echo "Service " . $log_entry->servicecode . " is not used on ";
+ echo $object->objectname . ".\n";
+ }
+ echo $log_entry->rawdata . "\n";
+ }
+ }
+}
+
+function find_notifications ()
+{
/*
* Do something with notification checks.