#!/usr/bin/perl # from: http://www.backupcentral.com/cgi-bin/netbackup-fom?_highlightWords=bpdbjobs&file=194 # modified a bit by gr for decoding the output use Data::Dumper; @job_info_labels = ('jobid', 'jobtype', 'state', 'status', 'class', 'sched', 'client', 'server', 'start', 'elapsed', 'end', 'stunit', 'try', 'operation', 'kbytes', 'files', 'path_last_written', 'percent', 'jobpid', 'owner', 'subtype', 'classtype', 'schedtype', 'priority', 'group', 'master_server', 'retention_units', 'retention_period', 'compression', 'kbyteslastwritten', 'fileslastwritten', 'filelistcount'); @job_try_labels_1 = ('trypid', 'trystunit', 'tryserver', 'trystarted', 'tryelapsed', 'tryended', 'trystatus', 'trystatusdescription', 'trystatuscount'); @job_try_labels_2 = ('trybyteswritten','tryfileswritten'); my @vault_info_labels = ('unknown1', 'unknown2', 'unknown3', 'vltrobot', 'vltname', 'vltprofile', 'vltsid', 'vltejects', 'unknown4', 'unknown5', 'unknown6', 'unknown7'); # Jacked from the (TOTALLY UNDOCUMENTED SO I CAN'T USE IT WITHOUT # LOTS OF PAIN) NBU::Job. my %op_codes = ( -1 => '---', 25 => 'Waiting', 2 => 'Connecting', 26 => 'Connecting', 0 => ' ? ', 27 => 'Mounting', 29 => 'Positioning', 3 => 'Writing', 35 => 'Writing', 5 => 'Duplicating', ); # The rest are just from bpdbjobs(1M) (operation isn't discussed # there, jerks). my %jt_codes = ( 0 => 'Backup', 1 => 'Archive', 2 => 'Restore', 3 => 'Verify', 4 => 'Duplication', 5 => 'Import', 6 => 'DB Backup', 7 => 'Vault', ); my %state_codes = ( 0 => 'Queued', 1 => 'Active', 2 => 'Requeued', 3 => 'Done', ); while(<>) { chomp; # Yeah, they really include escaped ,s; ditch them # ... only but there are some legit \\, situations on Windows $_ =~ s#\\\\#//#g; # You can also specify multiple STUs for vaults through different # duplication rules, and there are separated by /, / in the -all_columns # output. (Could I make this stuff up? No.) $_ =~ s/, /; /g; $_ =~ s/\\[,;]//g; undef($job); @columns = split(','); print Dumper(@columns); print "\n----\n\n"; } exit 0;