I have a (large - about 27k entries) xml file that I need to import into mysql.
Its a dump of the Cisco error message database and I want to import it to use on the syslog server so that when a message comes in, it will display more info w/o having to go to CCO and look it up manually.
Heres what the xml looks like:
<?xml version="1.0"?>
<cemdb class="simple">
<date>2006-06-28</date>
<error name="%">
<explanation></explanation
>
<action></action>
</error>
<error name="%">
<explanation>The POST has reported an incorrect memory size.</explanation>
<action>Replace the EAIM.</action>
</error>
<error name="%00:00:00:00:00:00">
<explanation>This is not a valid MAC address, and is probably being generated by non 802.1d
compliant hardware or software in the network. When there is a request to show the hosts the switch
has learned, it must sort the MAC addresses it has learned to reply to the request. The sort algorithm
cannot deal with a MAC address which is all zeroes, so the address will not be included in the table
of hosts which needs to be sorted. This means that even though the switch has learned a host with an
all zero MAC address, it will not show up in any display of hosts the switch has learned.</explanation>
<action>Track down the source of this bad address.</action>
</error>
<error name="%AAA-1-AAA_SESSION_L
IMIT_REJEC
T: aaa request rejected as maximum aaa sessions are in progress.">
<explanation>The AAA request is rejected because the maximum limit for concurrent AAA sessions
was reached.</explanation>
<action>If you purchased Cisco support through a Cisco reseller, contact the reseller
directly. If you purchased support directly from Cisco Systems, contact Cisco Technical Support.
Introduced Cisco MDS SAN-OS Release 1.3(1).</action>
</error>
<error name="%AAA-2-AAAMULTILINKE
RROR: [chars]([hex]): Acct db for Id [hex] absent">
<explanation>An AAA internal error has occurred.</explanation>
<action>Copy the error message exactly as it appears on the console or in the system
log, contact your Cisco technical support representative, and provide the representative with the
gathered information.</action>
</error>
<error name="%AAA-2-AAAMULTILINKE
RROR: [chars]([hex]): Acct db for Id [hex] absent">
<explanation>An AAA internal error has occurred.</explanation>
<action>Copy the error message exactly as it appears on the console or in the system log, contact your Cisco technical s
upport representative, and provide the representative with the gathered information.</action>
</error>
<error name="%AAA-2-AAA_NVRAM_UPG
RADE_FAILU
RE: upgrading of accounting log failed. [chars].">
<explanation>The accounting log could not be upgraded because of a problem with NVRAM. The
problem is described in the error message.</explanation>
<action>If you purchased Cisco support through a Cisco reseller, contact the reseller
directly. If you purchased support directly from Cisco Systems, contact Cisco Technical Support.
Introduced Cisco MDS SAN-OS Release 2.0(1b).</action>
</error>
<error name="%AAA-2-AAA_PROGRAM_E
XIT: aaa daemon exiting: [chars].">
<explanation>The AAA daemon is exiting.</explanation>
<action>If you purchased Cisco support through a Cisco reseller, contact the reseller
directly. If you purchased support directly from Cisco Systems, contact Cisco Technical Support.
Introduced Cisco MDS SAN-OS Release 1.3(1).</action>
</error>
</cemdb>
And heres the mysql table:
CREATE TABLE cemdb (
id bigint(20) unsigned NOT NULL auto_increment,
name varchar(128) NOT NULL default '',
error text,
descr text,
action text,
datetime datetime default NULL,
PRIMARY KEY (id),
UNIQUE KEY name (name)
) ENGINE=MyISAM;
Can someone please write a perl script to import this into mysql for me?
Start Free Trial