Use GRLoader to load a spreadsheet that rejects bad data by using a translation rule. In the following example, the name column begins on row C5 in Sheet9 of grloader_sample_spreadsheet.xls:
|
name |
class |
skip |
ip address |
|---|---|---|---|
|
server1 |
Server |
|
|
|
server2 |
Server |
yes |
|
|
server3 |
ACD |
1 |
|
|
server4 |
ACD |
|
bad |
|
server5 |
ACD |
|
bad |
|
server6 |
ACD |
|
|
Before you run GRLoader, create a translation file named Sheet9.rul that contains the following XML:
<ruleset>
<rule><attribute>skip</attribute><from>1</from>
<reject>yes</reject><rulename>rule1</rulename></rule>
<rule><attribute>skip</attribute><from>yes</from>
<reject>yes</reject><rulename>rule2</rulename></rule>
<rule><attribute>alarm_id</attribute><from>bad</from>
<reject>yes</reject><rulename>rule3</rulename></rule>
<rule><attribute>attributename</attribute>
<from>ip address</from><to>alarm_id</to>
<rulename>rule4</rulename></rule>
</ruleset>
After you create this XML file, load the data with GRLoader by executing the following command:
grloader -u username -p password -s http://sdm-host:8080 -i grloader_sample_spreadsheet.xls -sss Sheet9 -ssfr 6 -tf Sheet9.rul -n
Based on the translation rule, GRLoader completes the following actions:
Note: The attribute name translation (rule4) occurs before value translation, so the value translation rules must specify the translated attribute name. Even though the spreadsheet contained a column heading of ip address, the rule to reject the bad ip addresses (rule 3) must specify alarm_id.
|
Copyright © 2013 CA.
All rights reserved.
|
|