User Tools

Site Tools


commandlinetools

Command line tools

NAV has some useful command lines tools. We document the most important ones here.

Machine tracker data, i.e. ARP and CAM data, are never deleted from NAV. To delete old data run navclean.py. It behaves as the help option explains:

% ./navclean.py -h
Delete old arp and cam records from the NAV database.
 
Usage: navclean.py [options...]
 
Unless options are given, the number of expired ARP/CAM records will
be printed.  The default expiry limit is 6 months.  To actually delete
the expired records, add the -f option.
 
Available options are:
 
  -h, --help    -- Show this help screen.
  -q            -- Be quiet.
  -f            -- Force deletion of expired records.
  -e <date>     -- Set a different expiry date (default is 6 months
                   ago) on ISO format.
  -E <interval> -- Set a different expiry date using PostgreSQL
                   interval syntax.  E.g.: '30 days', '4 weeks', '6
                   months'

dump.py

The script extract data from the NAV database to text file(s). This is useful if you are migrating from one NAV installation to another and want to seed the new installation with the equipment you were monitoring in the old installation.

$ ./dump.py -h
usage: dump.py [options]
Dumps NAV database to importable files.
 
options:
  -h, --help              show this help message and exit
  -sSEP, --seperator=SEP  use SEP to seperate fields in output, [default :]
  -tTABLE, --table=TABLE  dump data from TABLE
  -oFILE, --output=FILE   dump data to FILE instead of stdout
  -a, --all               dump all tables to files named TABLE.txt

The tables you typically want export from are the tables that give data for bulk import when seeding the database. This will include:

  • netbox
  • room
  • location
  • org
  • usage
  • type
  • vendor
  • subcat
  • prefix
  • service

We currently do not support cabling and patch.

:!: Run /dump.py -a and you get all tables supported.

commandlinetools.txt · Last modified: 2007/10/01 16:23 by faltin