SysOrb Network Monitoring System Administrator's Guide: For version 4.6.0 | ||
---|---|---|
Prev | Chapter 11. SysOrb Import and Export tools | Next |
In the following we will demonstrate how the importer and exporter can be used to automate the creation of nodes in SysOrb. These concepts can easily be expanded to allow automatic creation of other objects is SysOrb.
In this example we will assume that there exists a domain in the root-domain called Test, and in that domain a node called template is placed.
In order to export the contents of the Test domain, the command in the first line of the following example is used. The program will respond with something like the following lines.
Example 11-1. Exporting contents of the Test domain
$ sysorb-exporter -l admin -P admtest -e Test -i CheckGroup -f template.xml Exporting database Exporting domain Test. Exporting statistical data (1.3266410235). Please wait. Done
The -i CheckGroup is included in order to keep the exporter-tool from exporting the Checks configured on the node.
The above command will export a file called template.xml which will contain the following (note that there will be some differences between different exports):
Example 11-2. Contents of the exported file
<?xml version="1.0"?> <Meta version="1.0" description="SysOrb exported database" timestamp="2004-04-13-T15:52:38"> </Meta><Object id="1.3266410236" type="Domain"> <Property type="Enumeration(14)" name="downNotify" value="1"/> <Property type="String" name="label" value=""/> <Property type="String" name="name" value="Test"/> <Property type="Computed String" name="siblingName" value="Test"/> <Object id="1.3266410235" type="Node"> <Property type="Boolean" name="acknowledgeAlerts" value="false"/> <Property type="Integer" name="alert" value="1000"/> <Property type="Integer" name="alertCeiling" value="1100"/> <Property type="Enumeration(12)" name="alertStrategy" value="1"/> <Property type="Unsigned Integer" name="checkinFrequency" value="30"/> <Property type="Integer" name="checkinScore" value="-5"/> <Property type="Enumeration(14)" name="downNotify" value="1"/> <Property type="String" name="label" value=""/> <Property type="Integer" name="missedCheckinScore" value="10"/> <Property type="String" name="name" value="template"/> <Property type="ObjectSet" name="nodeClasses" value=""/> <Property type="Computed String" name="siblingName" value="template"/> <Property type="String" name="snmpCommunity" value="public"/> <Property type="Enumeration(20)" name="snmpVersion" value="0"/> <Property type="Integer" name="warn" value="200"/> <Property type="Integer" name="warnCeiling" value="300"/> </Object> </Object>
Before this file can be used to create new nodes in SysOrb, the name of the node must be changed. This is the property called name. Just change the value to something other than template. The following example shows the modified file, which can be used to create a node called New Node.
Example 11-3. Modified XML file, ready for import
<?xml version="1.0"?> <Meta version="1.0" description="SysOrb exported database" timestamp="2004-04-13-T15:52:38"> </Meta><Object id="1.3266410236" type="Domain"> <Property type="Enumeration(14)" name="downNotify" value="1"/> <Property type="String" name="label" value=""/> <Property type="String" name="name" value="Test"/> <Property type="Computed String" name="siblingName" value="Test"/> <Object id="1.3266410235" type="Node"> <Property type="Boolean" name="acknowledgeAlerts" value="false"/> <Property type="Integer" name="alert" value="1000"/> <Property type="Integer" name="alertCeiling" value="1100"/> <Property type="Enumeration(12)" name="alertStrategy" value="1"/> <Property type="Unsigned Integer" name="checkinFrequency" value="30"/> <Property type="Integer" name="checkinScore" value="-5"/> <Property type="Enumeration(14)" name="downNotify" value="1"/> <Property type="String" name="label" value=""/> <Property type="Integer" name="missedCheckinScore" value="10"/> <Property type="String" name="name" value="New Node"/> <Property type="ObjectSet" name="nodeClasses" value=""/> <Property type="Computed String" name="siblingName" value="template"/> <Property type="String" name="snmpCommunity" value="public"/> <Property type="Enumeration(20)" name="snmpVersion" value="0"/> <Property type="Integer" name="warn" value="200"/> <Property type="Integer" name="warnCeiling" value="300"/> </Object> </Object>
Using the modified file it is possible to create a node called New Node in any domain on the SysOrb Server. To create the node in the domain called New Domain (must be created before the command is executed), use the following command:
Example 11-4. Creating a node using sysorb-importer
$ sysorb-importer -l admin -P admtest -i "New Domain" -f template.xml Importing database into domain 1.1004032985 and replacing it. Importing configuration.. Done
It is possible to expand on this to create domains, checks etc. from the command line. It is also possible to export the statistical data gathered by SysOrb if it must be processed by some other tool. However in this case sysorb-tool is a better solution, which is described in the next chapter.