From 71b917124f8b457608667bb1ba0343155cc24425 Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 29 Jan 2009 02:41:02 +0000 Subject: [PATCH] added eventtype column in the eventlog table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2666 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Schema.pm | 9 +++++++-- perl-xCAT/xCAT/Utils.pm | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 8309cc40a..65bc522c6 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -584,7 +584,7 @@ performance => { }, eventlog => { - cols => [qw(recid eventtime monitor monnode node application component id severity message rawdata comments disable)], + cols => [qw(recid eventtime eventtype monitor monnode node application component id severity message rawdata comments disable)], keys => [qw(recid)], types => { recid => 'INTEGER AUTO_INCREMENT', @@ -593,7 +593,8 @@ eventlog => { descriptions => { recid => 'The record id.', eventtime => 'The timestamp for the event.', - monitor => 'The name of the monitor that monitors this event.', #in RMC, it's the condition name + eventtype => 'The type of the event.', # for RMC it's either "Event" or "Rearm event". + monitor => 'The name of the monitor that monitors this event.', #for RMC, it's the condition name monnode => 'The node that monitors this event.', node => 'The node where the event occurred.', application => 'The application that reports the event.', #RMC, Ganglia @@ -1480,6 +1481,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); tabentry => 'eventlog.eventtime', access_tabentry => 'eventlog.recid=attr:recid', }, + {attr_name => 'eventtype', + tabentry => 'eventlog.eventtype', + access_tabentry => 'eventlog.recid=attr:recid', + }, {attr_name => 'monitor', tabentry => 'eventlog.monitor', access_tabentry => 'eventlog.recid=attr:recid', diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 3ae62171a..d68e00f00 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2889,6 +2889,25 @@ sub get_image_name { rawdata -- The data that associated with the event. Returns: (ret code, error message) + Example: + my @a=(); + my $event={ + eventtime=>"07-28-2009 23:02:03", + node => 'node1', + rawdata => 'kjdlkfajlfjdlksaj', + }; + push (@a, $event); + + my $event1={ + node => 'cu03cp', + monnode => 'cu03sv', + application => 'RMC', + component => 'IBM.Sensor', + id => 'AIXErrorLogSensor', + severity => 'warning', + }; + push(@a, $event1); + xCAT::Utils->logEventsToDatabase(\@a); =cut @@ -2915,7 +2934,8 @@ sub logEventsToDatabase{ } $event->{eventtime}=$currtime; } - $tab->setAttribs(undef, $event); + my @ret=$tab->setAttribs(undef, $event); + if (@ret > 1) { return (1, $ret[1]); } } $tab->commit; }