Dumping all resources into a single file
On the odd occasion you may want to collect all the NetWorker resource information into a single file, this could be useful of you are wanting to import the data into some form of database, spreadsheet or you just want a simple method to search for a certain string.
It's not uncommon to perform this task. In fact NetWorker does it everytime you run the NetWorker support script nsr_support
under UNIX/Linux or nsrsup
under Windows.
If you know how to use nsradmin you simply use these options:
option | descrption |
---|---|
option hidden | switches the hidden attributes on |
. | sets the query for all resources |
prints the inforamtion gathered by the actual query command |
Creating NSRADMIN query file
As nsradmin
does not allow the output to a file it is better to create a query file for the options you wish to run, and then use this for input into nsradmin and redirect the output
Using your favourite text editor
Whether you are on a UNIX, Linux or Windows system, use your favourite text editor and create a file which contains the following:
option hidden . print
Using command line
Under UNIX/Linux:
# cat >query.txt <<_EOF_ option hidden . print _EOT_
Under Windows:
C:\%gt; copy con: query.txt option hidden . print ^Z 1 file(s) copied.
Create the resource file
Now we have the query file, we use this as input to nsradmin and redirect the output, this works under UNIX/Linux and Windows environments:
nsradmin -i query.txt > nsr_res_dump.txt
If you want to review the conteints of the file, use your favourite text editor, or simply type:
more nsr-res_dump.txt Hidden display option turned on Display options: Dynamic: Off; Hidden: On; Resource ID: Off; Current query: name: ; type: ; Show all attributes Bound to: schlumpf Display options: Dynamic: Off; Hidden: On; Resource ID: Off; type: NSR notification; name: Tape mount request 2; comment: ; action: nsrlog;
Further reading
Another nice feature is the fact that NetWorker would convert this resource information when needed. For example, you could delete the resource directories and rebuild them using this single file - you do not even have to remove the framed information
This is exactly what NetWorker will do during an upgrade - It converts the database if necessary.
# /etc/init.d/networker stop # rm -rf /nsr/res/nsrdb # rm -rf /nsr/res/nsrladb # cp nsr_res_dump.txt /nsr/res/nsr.res # /etc/init.d/networker start
The above 5 commands will stop networker, remove all the resource entries and recreate the nsrdb nsrla databases from the nsr.res file upon the next start of the NetWorker daemons
Here is the requivalent for a NetWorker server running on Windows
C:\> net stop nsrexecd /f C:\> rmdir /S d:\networker\nsr\res\nsrdb C:\> rmdir /s d:\networker\nsr\res\nsrladb C:\> copy nsr_res_dump.txt d:\nsr\res\nsr.res C:\> net start nsrd
All you have to do now is to verify whether all your NetWorker resources are available.