Commit 096f72d5 authored by Kevin Atkinson's avatar Kevin Atkinson

Added error logging API. See tbsetup/libtblog.pm.in and tbsetup/libtblog.sql.

parent 004925c6
......@@ -71,6 +71,7 @@ $| = 1;
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use libtblog;
#
# We don't want to run this script unless its the real version.
......
......@@ -154,7 +154,7 @@ use vars qw(@ISA @EXPORT);
TBAdmin TBOpsGuy TBProjAccessCheck TBNodeAccessCheck TBOSIDAccessCheck
TBImageIDAccessCheck TBExptAccessCheck ExpLeader MarkNodeDown
SetNodeBootStatus OSFeatureSupported IsShelved NodeidToExp NodeidToExpOldReserved
UserDBInfo DBQuery DBQueryFatal DBQueryWarn DBWarn DBFatal
UserDBInfo DBQuery DBQueryFatal DBQueryWarn DBWarn DBFatal DBErr
DBQuoteSpecial UNIX2DBUID ExpState SetExpState ProjLeader
ExpNodes ExpNodesOldReserved DBDateTime DefaultImageID GroupLeader TBGroupUnixInfo
TBValidNodeLogType TBValidNodeName TBSetNodeLogEntry
......@@ -4298,6 +4298,14 @@ sub DBQuoteSpecial($)
return $string;
}
#
# Get the Error From the Last Database query
#
sub DBErr()
{
return $DB->err;
}
#
# Return a (current) string suitable for DB insertion in datetime slot.
# Of course, you can use this for anything you like!
......
......@@ -816,6 +816,30 @@ CREATE TABLE location_info (
PRIMARY KEY (node_id,building,floor)
) TYPE=MyISAM;
--
-- Table structure for table `log`
--
CREATE TABLE log (
seq int(10) unsigned NOT NULL auto_increment,
stamp int(10) unsigned NOT NULL default '0',
pidx int(11) NOT NULL default '0',
uid int(11) default NULL,
session int(10) unsigned NOT NULL default '0',
invocation int(10) unsigned NOT NULL default '0',
parent int(10) unsigned NOT NULL default '0',
script smallint(3) NOT NULL default '0',
level smallint(2) NOT NULL default '0',
priority smallint(3) NOT NULL default '0',
inferred tinyint(1) NOT NULL default '0',
cause varchar(32) NOT NULL default '',
type enum('normal','entering','exiting','thecause') NOT NULL default 'normal',
relevant tinyint(1) NOT NULL default '0',
mesg text NOT NULL,
PRIMARY KEY (seq),
KEY session (session)
) TYPE=MyISAM;
--
-- Table structure for table `login`
--
......@@ -1485,6 +1509,17 @@ CREATE TABLE portmap (
pport varchar(32) NOT NULL default ''
) TYPE=MyISAM;
--
-- Table structure for table `priorities`
--
CREATE TABLE priorities (
priority smallint(3) NOT NULL default '0',
name varchar(8) NOT NULL default '',
PRIMARY KEY (priority),
UNIQUE KEY name (name)
) TYPE=MyISAM;
--
-- Table structure for table `proj_memb`
--
......@@ -1605,6 +1640,17 @@ CREATE TABLE scheduled_reloads (
PRIMARY KEY (node_id)
) TYPE=MyISAM;
--
-- Table structure for table `scripts`
--
CREATE TABLE scripts (
script smallint(3) NOT NULL auto_increment,
name varchar(24) NOT NULL default '',
PRIMARY KEY (script),
UNIQUE KEY id (name)
) TYPE=MyISAM;
--
-- Table structure for table `sitevariables`
--
......
......@@ -121,6 +121,7 @@ REPLACE INTO exported_tables VALUES ('event_objecttypes');
REPLACE INTO exported_tables VALUES ('exported_tables');
REPLACE INTO exported_tables VALUES ('foreign_keys');
REPLACE INTO exported_tables VALUES ('mode_transitions');
REPLACE INTO exported_tables VALUES ('priorities');
REPLACE INTO exported_tables VALUES ('state_timeouts');
REPLACE INTO exported_tables VALUES ('state_transitions');
REPLACE INTO exported_tables VALUES ('state_triggers');
......@@ -255,6 +256,20 @@ REPLACE INTO mode_transitions VALUES ('ALWAYSUP','ISUP','RELOAD-MOTE','SHUTDOWN'
REPLACE INTO mode_transitions VALUES ('ALWAYSUP','ISUP','RELOAD-MOTE','ISUP','ReloadStart');
REPLACE INTO mode_transitions VALUES ('RELOAD-MOTE','SHUTDOWN','ALWAYSUP','ISUP','ReloadDone');
--
-- Dumping data for table `priorities`
--
REPLACE INTO priorities VALUES (0,'EMERG');
REPLACE INTO priorities VALUES (100,'ALERT');
REPLACE INTO priorities VALUES (200,'CRIT');
REPLACE INTO priorities VALUES (300,'ERR');
REPLACE INTO priorities VALUES (400,'WARNING');
REPLACE INTO priorities VALUES (500,'NOTICE');
REPLACE INTO priorities VALUES (600,'INFO');
REPLACE INTO priorities VALUES (700,'DEBUG');
--
-- Dumping data for table `state_timeouts`
--
......
......@@ -2864,3 +2864,9 @@ last_net_act,last_cpu_act,last_ext_act);
version entries. Then remove the column from the nodes table:
alter table nodes drop column bios_version;
4.16: Add new tables for the logging subsystem (libdblog)
mysql tbdb < tbsetup/libtblog.sql
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment