Automating Host Group Management > Load Details of New Hosts or Update Existing Hosts
  
Version 10.0.01
Load Details of New Hosts or Update Existing Hosts
Description
Imports host details from a comma-delimited file containing a list of hosts and host attributes.
Usage
execute load_package.loadServerFile('<file_name>'[, '<source_name>']);
 
file_name is the fully qualified path to the csv file. Example:
/opt/aptare/database/hosts.csv
source_name is an optional, case-insensitive string, up to 100 characters, representing the source of the host details; for example, CMDB might be relevant for a change management database. This source information is retained for historical purposes, to track how the host was added to the database. If nothing or NULL is provided for this parameter, CSV Load will be inserted as the source into the reporting database.
Load File Specification
The specification for the comma-delimited file is as follows:
path_to_host_group, internal_name, external_name, description, location, IP_address, make, model, OS
 
Example:
/APTARE/Test,testhost01,testhost01,description,location,172.20.16.1,Sun,E450,Solaris 10
/APTARE/Test,testhost02,testhost02,,location,172.20.16.2,Sun,,Solaris
 
The detailed specification for each field follows:
internal_name CHAR(128) NOT NULL
external_name CHAR(128) NOT NULL
description CHAR(256)
location CHAR(64)
ip_address CHAR(40)
make CHAR(64)
model CHAR(64)
os_version CHAR(128)
Data Constraints
Field values cannot contain embedded commas.
The first field, path_to_host_group, must be the full path to an existing host group otherwise the host will not be inserted.
The csv file must exist and be readable.
The csv filename must be specified within single quotes.
Logic Conditions
If the host already exists in the specified host group, the utility updates its details.
If the host does not already exist in the Reporting Database, the utility adds the host to the specified host group.
If a host attribute field has a NULL value in the input file, the corresponding field in the database will not be updated for a pre-existing row.
The utility applies case differences in the input file as updates to preexisting rows.
Since the primary key to the record is the internal_name, the internal_name for a host cannot be updated via this utility.
If the number of parameters passed in a row exceeds 9, the utility skips the row.
Logging
The utility logs all additions, updates, warnings and errors to the file scon.log, which is located under /tmp by default on Linux systems and C:\opt\oracle\logs on Windows systems. Logging strings are typically in the following format:
Date -> Time -> Level -> load_package:sub_routine -> Action
 
Where:
Level is DBG, INFO,WARN, or ERR.
sub_routine is the sub-routine that is being executed (e.g. loadHostLine).
Action is the action that was being reported on.
 
Example:
14-MAY 21:56:08 INFO : updating host: z0001-web0600-s in /APTARE/Infrastructure