NetWorker: How to Redirect nsradmin and jobquery Output to a Text File
Summary: This article provides an overview of how to redirect nsradmin or jobquery outputs to a file on both Linux and Windows NetWorker systems.
Instructions
nsradmin - The nsradmin command is a command-line based administrative program for the NetWorker system. nsradmin monitors and modifies configured NetWorker resources.jobquery - NetWorker jobs database query program. The jobquery command is a command-line based program that is used to query NetWorker server’s jobs database.
nsradmin:
You can review which resource types are known to the NetWorker database nsradmin is accessing by entering type at the nsradmin command prompt:
nsradmin> type
Known types: NSR, NSR auditlog, NSR client, NSR client fix,
NSR cloneconfig, NSR Data Domain, NSR device,
NSR directive, NSR ESRS, NSR hypervisor,
NSR label, NSR license, NSR lockbox,
NSR NAS discovery task, NSR notification,
NSR policy, NSR pool, NSR Protection Group,
NSR Protection Policy, NSR savesets count,
NSR schedule, NSR service, NSR stage,
NSR Storage Node, NSR task, NSR usergroup,
NSR VMware proxy, NSR vproxy log aggregate;
The available types vary based on the NetWorker server configuration and whether nsradmin is accessing the nsrdb (server) or nsrladb (client) database.
The options available with nsradmin:
Commands are:
bind [query]
create attrlist
delete [query]
edit [query]
help [command]
print [query] (set current query)
server [name]
show [attrlist]
types
update attrlist
append attrlist
quit
visual [query]
option [list]
unset [list]
. [query]
? [command]
exit
Where:
query ::= attrlist
attrlist ::= attribute [; attribute]*
attribute ::= name [: [value [, value]* ]
You can enter a visual command-line interface through nsradmin, by entering visual at the nsradmin command prompt. You can navigate through the configured resources to see what type of resources exist, and the common attribute:value strings.
To access the NetWorker client database, specify the following flag when running<
nsradmin:
nsradmin -p nsrexecdTo access the NetWorker server database in offline mode, specify the following when running
nsradmin:
nsradmin -d /nsr/res/nsrdb
NOTE: Absolute path to the
nsrdb or nsrladb is required when accessing in offline mode. For additional instructions, see: NetWorker: How to use the nsradmin command-line utility to manage NetWorker resources
jobquery
You can review which resource types are known to the NetWorker server jobsdb jobquery is accessing by entering type at the jobquery command prompt:
jobquery> type
Known types: active job db, backup action job,
bootstrap save job, Client push master job,
clone job, generic remote command,
job indication, recover pipe to save job,
save job, savefs job, session info, task job,
utility job, vproxysave job, workflow job;
The options available within jobquery are:
Commands are:
print [query] (set current query)
show [attrlist]
types
all
quit
help [command]
. [query]
? [command]
Where:
query ::= attrlist
attrlist ::= attribute [; attribute]*
attribute ::= name [: [value [, value]* ]
NOTE:
jobquery can be used to review the jobsdb. The jobsdb retention is defined in the NetWorker server properties; by default, this value is set to 72 hours. It is only possible to query data within the jobsdb retention period.
Redirecting Output To A File
The process assumes that you know which subset of commands you want to run while redirecting output to an output file. Output is not shown in the prompt and sent directly to the file.
Windows:
- Open an admin command prompt.
- Run the
nsradminorjobquerycommand using the following syntax:
nsradmin -i - 2>&1 > C:\Users\Administrator\Desktop\nsradmin_out.txt
- Enter
nsradminorjobquerysubcommands that you want to run, when done you can return to the command prompt by enteringquit.
C:\Users\Administrator.EMCLAB>nsradmin -i - 2>&1 > C:\Users\Administrator\Desktop\nsradmin_out.txt show name; networker version p type: nsr client quit
name: winsrvr2k19.emclab.local;
NetWorker version: 19.3.0.0.Build.21;
name: winsrvr2k12.emclab.local;
NetWorker version: 19.4.0.3.Build.167;
name: winsrvr2k16.emclab.local;
NetWorker version: 19.4.0.2.Build.127;
name: ubuntu.emclab.local;
NetWorker version: 19.3.0.1.Build.51;
name: vcenter67.emclab.local;
NetWorker version: 19.4.0.3.Build.167;
name: winsrvr2k12.emclab.local;
NetWorker version: 19.4.0.3.Build.167;
name: winsrvr2k12.emclab.local;
NetWorker version: 19.4.0.3.Build.167;
name: vmwin2k12.emclab.local;
NetWorker version: 19.3.0.2.Build.89;
name: vcenter.emclab.local;
NetWorker version: ;
name: winsrvr2k16.emclab.local;
NetWorker version: 19.4.0.2.Build.127;Linux:
- Open a root command prompt:
- Run the
nsradminorjobquerycommand using the following syntax.
cat << EOB | jobquery -i - 2>&1 > jobquery_out.txt
- Enter
nsradminorjobquerysubcommands that you want to run, when done you can return to the command prompt by enteringEOB.
[root@networker-mc ~]# cat << EOB | jobquery -i - 2>&1 > jobquery_out.txt > show name; job id; saveset time > print completion status: failed > EOB
[root@networker-mc ~]# tail jobquery_out.txt
job id: 96641;
name: index backup;
saveset time: 1664911693;
job id: 96640;
name: index backup;
saveset time: 1664911688;