From 41d8072ff06d79a9dfdac3f634ae2e95d20d1751 Mon Sep 17 00:00:00 2001 From: arjen Date: Wed, 29 Oct 2003 09:58:29 +0000 Subject: [PATCH] Create separate notifications for different objects in service_check(). --- src/gcm_daemon/gcm_daemon.php | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/gcm_daemon/gcm_daemon.php b/src/gcm_daemon/gcm_daemon.php index 12ccdde..bd65a72 100755 --- a/src/gcm_daemon/gcm_daemon.php +++ b/src/gcm_daemon/gcm_daemon.php @@ -20,7 +20,10 @@ Gnucomo-0.0.8: September 4th 2003 $Log: gcm_daemon.php,v $ - Revision 1.16 2003-09-03 12:48:48 arjen + Revision 1.17 2003-10-29 09:58:29 arjen + Create separate notifications for different objects in service_check(). + + Revision 1.16 2003/09/03 12:48:48 arjen Check the log table against the servies running on an object and create notifications if a service is not supposed to be available or is not known at all. @@ -56,7 +59,7 @@ */ -// $Id: gcm_daemon.php,v 1.16 2003-09-03 12:48:48 arjen Exp $ +// $Id: gcm_daemon.php,v 1.17 2003-10-29 09:58:29 arjen Exp $ ini_set('include_path', '.:./classes:../phpclasses'); ini_set('html_errors', 'false'); @@ -453,8 +456,8 @@ function service_check() { global $dbms; - $unknown_notification = 0; - $unused_notification = 0; + $unknown_notification = array(); + $unused_notification = array(); $last_log = 0; // How far did we get last time ? @@ -501,30 +504,32 @@ function service_check() if ($dbms->num_rows($dbms->query($qry)) == 0) { - if ($unknown_notification == 0) + if (!isset($unknown_notification[$log_entry->objectid])) { $remark = "One or more log entries from a service that is not in the database"; - $unknown_notification = $dbms->new_notification($log_entry->objectid, 'service unknown', $remark); + $unknown_notification[$log_entry->objectid] = + $dbms->new_notification($log_entry->objectid, 'service unknown', $remark); } - if ($unknown_notification != 0) + if (isset($unknown_notification[$log_entry->objectid])) { $insertion = "INSERT INTO log_notification (notificationid, logid) VALUES ('"; - $insertion .= $unknown_notification . "', '"; + $insertion .= $unknown_notification[$log_entry->objectid] . "', '"; $insertion .= $log_entry->logid . "')"; $dbms->query($insertion); } } else { - if ($unused_notification == 0) + if (!isset($unused_notification[$log_entry->objectid])) { $remark = "One or more log entries from a service not running on this object"; - $unused_notification = $dbms->new_notification($log_entry->objectid, 'service not used', $remark); + $unused_notification[$log_entry->objectid] = + $dbms->new_notification($log_entry->objectid, 'service not used', $remark); } - if ($unused_notification != 0) + if (isset($unused_notification[$log_entry->objectid])) { $insertion = "INSERT INTO log_notification (notificationid, logid) VALUES ('"; - $insertion .= $unused_notification . "', '"; + $insertion .= $unused_notification[$log_entry->objectid] . "', '"; $insertion .= $log_entry->logid . "')"; $dbms->query($insertion); } -- 2.11.0