csv import

Support requests, bug reports, questions etc.
kmoller

csv import

Post by kmoller » Fri Mar 23, 2012 10:38

Hi

I need help!! I am trying import from a csv file!!

cvs file :

"hostname";"alias";"adress";"os";"notification_period";"notification_interval";"contact_groups";
switch001;switch001;10.12.8.1;Switch;24x7;24x7;admins;

i do, and get :

./add_items_from_csv.pl -c hosts -f tmp.csv -s -x5

[ Initializing NConf perl-API (library version 0.3, written by A. Gargiulo) ]
[ Copyright (c) 2006 - 2012 Sunrise Communications AG, Zurich, Switzerland ]

[TRACE] |NConf::DB::setDbReadonly| Entered setDbReadonly()
[DEBUG] |NConf::DB::setDbReadonly| Setting DB read-only to 1
[INFO] |NConf::DB::setDbReadonly| Running in simulation mode. No modifications will be made to the database!
[INFO] Started executing ./add_items_from_csv2.pl
[TRACE] |NConf::ImportCsv::parseCsv| Entered parseCsv()
[TRACE] |NConf::ImportCsv::parseCsv| Parameters - File: tmp2.cvs, Class: hosts, CSV_delim: ;
[TRACE] |NConf::ImportCsv::parseCsv| Parameters - csv_delim: ;
[TRACE] |NConf::ImportCsv::parseCsv| Looking for CSV syntax in file header
[ERROR] |NConf::ImportCsv::parseCsv| CSV syntax not found in file header. Aborting.


anybody ?

User avatar
Tontonitch
NConf addict
NConf addict
Posts: 254
Joined: Fri May 07, 2010 10:14
Location: Thionville, France
Contact:

Re: csv import

Post by Tontonitch » Fri Mar 23, 2012 16:43

Hi,
Your first line in the csv file, specifying the CSV format, is not well formatted.
Your file should be:
"host_name";"alias";"address";"os";"notification_period";"notification_interval";"contact_groups";
switch001;switch001;10.12.8.1;Switch;24x7;24x7;admins;

You may also remove the ";" at the end of each line, but it should also work with.

Also, your command is wrong (host and not hosts for the class type). It should be:

Code: Select all

./add_items_from_csv.pl -c host -f tmp.csv -s -x5
BR,
Yannick

kmoller

Re: csv import

Post by kmoller » Fri Mar 23, 2012 18:05

hi Yannick

it works

merci :)

Br kenneth

Locked