Unsolved
This post is more than 5 years old
5 Posts
0
4332
August 30th, 2011 01:00
NSRADMIN scripting to determine datazone passphrase
Hi,
I'm trying to develop a script that will check all of our organisations various NetWorker Storage Nodes and return what datazone passphrase the node is using.
The script I have developed so far consists of a .vbs script that generates an import file to be passed to the nsradmin command and the output from this command to be piped to an export file.
The command therefore looks like this:
nsradmin -i import.txt > export.txt
The import file consists of multiple commands; one for each node in organisation; and they are formatted as below:
server
show datazone pass phrase
print type: nsr
quit
Where node name is the name of the individual node bein quried, then there is a single quit command at the end of the import file.
This generates output as per below:
Bound to:
hostname: ;
ONC program number: 390109;
ONC version number: 2;
resource identifier: 0(0);
datazone pass phrase: password;
Where password is the current pass phrase for the node.
This all works properly until a server is unavailable or not contactable i.e. network issues, powered off, etc. The nsradmin command in this instance then returns the pass phrase from the last node it successfully queried from the import file; this is a major issue.
However if you run the same command individually to that server direct from command line and don't use an import file it returns an error "Can't bind to server" or similar.
So the two questions are 1) why the discrepency in behaviour between running the command individually and as part of a improt file and 2) is there any option to switch on error checking on the nsradmin command?
All assistance gratefully received as this is causing major headaches.
tMarquee



coganb
736 Posts
0
August 30th, 2011 07:00
Hi,
I suspect the discrepancy in behaviour may be something to do with the running of nsradmin in online mode or in offline mode in the two scenarios. If I were you, I'd do a connection check at the start of the script on each of the machines and develop a list of ok hosts. Then run the nsradmin command against each host on the list.
-Bobby
tMarquee
5 Posts
0
August 30th, 2011 07:00
Firstly thank you for the reply Bobby!
I had considered something along these lines, initially thinking that a simple ping test to each node might do, but then determined I would also need to ensure that the networker services are running, that they can be contacted i.e. no firewall blocking.
I was therefore hoping to solve the underlying issue of why / how the nsradmin command appears to be caching the last node that a command ran on rather than return the "can't bind to server" message that it returns when run directly from command line.
Is there a way of clearing out the results between queries, for example,
server abc
show datazone pass phrase
print type: nsr
[ clear query ]
server def
show datazone pass phrase
print type: nsr
[ clear query ]
server xyz
show datazone pass phrase
print type: nsr
[ clear query ]
quit
If not may have to look at changing or abandoning use of import file.
tMarquee
coganb
736 Posts
1
August 30th, 2011 23:00
Hi,
Why would your storage nodes have different datazone pass phrases? I thought the pass phrase was per datazone.
If you were to test the connectivity, then rpcinfo would be better than ping, but I understand why you don't want to do that. If you suspect that nsradmin is caching results, then you could try running the nsradmin command as a single line from your script like this:
printf "show datazone pass phrase \n print type : NSR \n" | nsradmin -i - > pass_phrase_output.txt
-Bobby
ble1
4 Operator
•
14.3K Posts
1
September 2nd, 2011 03:00
Then just do:
printf "show datazone pass phrase \n print type : NSR \n" | nsradmin -i - -s
printf "show datazone pass phrase \n print type : NSR \n" | nsradmin -i - -s
printf "show datazone pass phrase \n print type : NSR \n" | nsradmin -i - -s
printf "show datazone pass phrase \n print type : NSR \n" | nsradmin -i - -s
etc...
ble1
4 Operator
•
14.3K Posts
0
September 2nd, 2011 03:00
Agree with Bobby.. this is set per datazone thus no need to query storage nodes.
tMarquee
5 Posts
0
September 2nd, 2011 03:00
Unfortunately rightly or wrongly we do have several datazones each with a storage node backing up that zone.
We only use a centralised Enterprise management console to administer and monitor the organisations backups across these zones.
So to set or check a passphrase we woudl still need to manually select each node listed and launch networker console and the networker management console.and then click Properties and check under configuration tab.
The script was intended to avoid this process by automating a check for each node and confirming the password and email us a summary, so that if it has been changed for any reason we have time to correct it before that evening's backups run.
tMarquee
tMarquee
5 Posts
0
September 2nd, 2011 04:00
Bobby / Hrvoje,
Pardon my ignorance but the script we have is a VBS / VB script and not aware of a single equivelant command to printf in this language.
But will look at this route as this sounds exactly what i'm after.
tMarquee
ble1
4 Operator
•
14.3K Posts
0
September 2nd, 2011 04:00
Try to use echo instead of printf... I admit that on Windows it might be different as I use UNIX, but at least printf part I'm sure can be replaced with echo command.
tMarquee
5 Posts
0
November 7th, 2011 08:00
Sorry for the delay in posting back on this.
I have just tried several variations of using echo to pipe the query to the NSRADMIN command and in turn direct the output to a text file but I cannot see any way on a windows o/s to replicate the printf functionality.
For instance:
echo "print datazone pass phrase \n print type : NSR \n" | nsradmin -i - -s test
returns: -
unknown command: "show"
Just to reiterate what I am trying to achieve ...
We need a way to automatically interogate each server in turn to retrieve the current pass phrase so that we can ensure it is correct, we want to do this via use of a script that can be schedule via Windows Task Scheduler on the NMC machine, which has access through any firewalls, security, etc o all other servers.
ble1
4 Operator
•
14.3K Posts
0
November 9th, 2011 14:00
Setting password to blah.
C:\>nsradmin
NetWorker administration program.
Use the "help" command for help.
nsradmin> show datazone pass phrase
nsradmin> print type: NSR
datazone pass phrase: ;
nsradmin> update datazone pass phrase: blah
datazone pass phrase: blah;
Update? Yes
updated resource id 2.0.8.23.0.0.0.0.189.195.132.78.0.0.0.0.10.130.3.148(67)
nsradmin> q
Querying the password:
C:\>nsradmin -s hcrvelin -i input.txt
datazone pass phrase: blah;
Input file is:
C:\>type input.txt
show datazone pass phrase
print type: NSR
Important: after second line you must press so that you have extra blank line. If you do not do that then you will get an error like:
C:\>nsradmin -s hcrvelin -i input.txt
Resource parse error: Unexpected end of input
type: NSR ^
usage: print [query] (set current query)