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.
*/
-// $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');
{
global $dbms;
- $unknown_notification = 0;
- $unused_notification = 0;
+ $unknown_notification = array();
+ $unused_notification = array();
$last_log = 0;
// How far did we get last time ?
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);
}