I wrote an awk script that lets me parse the file and print the first host name, but I can't figure out how to get it to display other hosts in the same policy.
BEGIN{printf ("%-28s %-10s %-30s %-15s %-30s %-38s %-15s\n", "Policy", "Active", "Client", "OS", "Schedule", "Type", "Policy Type\n=========================================================
========================================================================================================================")}
/^Policy Name/{policy = $3}
/Policy Type:/{ptype = $3}
/Active/{active = $2}
/HW\/OS\/Client:/{os = $(NF-1); client = $NF}
/ Schedule:/{schedule = $2}
/ Type:/{type = $2" "$3" "$4; printf ("%-28s %-10s %-30s %-15s %-30s %-38s %-15s\n", policy, active, client, os, schedule, type, ptype)}
I tried changing the HW/OS/Client line to the one below, but that doesn't help.
/HW\/OS\/Client:/,/Include:/{os = $(NF-1); client = $NF}
The resulting output is something like this:
test_policy yes client1 Windows2000 monthly_full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Cumulative-Inc Cumulative Incremental Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 monthly_full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Differential Differential Incremental Backup MS-Windows-NT
The desired output is:
test_policy yes client1 Windows2000 monthly_full Full Backup MS-Windows-NT
test_policy yes client2 Windows2000 monthly_full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Full Full Backup MS-Windows-NT
test_policy yes client2 Windows2000 Full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Cumulative-Inc Cumulative Incremental Backup MS-Windows-NT
test_policy yes client2 Windows2000 Cumulative-Inc Cumulative Incremental Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 monthly_full Full Backup MS-Windows-NT
test_policy2 yes client4 Windows2008 monthly_full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Full Full Backup MS-Windows-NT
test_policy2 yes client4 Windows2008 Full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Differential Differential Incremental Backup MS-Windows-NT
test_policy2 yes client4 Windows2008 Differential Differential Incremental Backup MS-Windows-NT
The input file looks like this:
Policy Name: test_policy
Policy Type: Standard
Active: yes
Effective date: 05/07/2003 11:58:43
Client Compress: no
Follow NFS Mounts: no
Cross Mount Points: no
Collect TIR info: no
Block Incremental: no
Mult. Data Streams: yes
Client Encrypt: no
Checkpoint: yes
Interval: 15
Policy Priority: 0
Max Jobs/Policy: Unlimited
Disaster Recovery: 0
Collect BMR info: no
Residence: Staging
Volume Pool: NetBackup
Server Group: *ANY*
Keyword: (none specified)
Data Classification: -
Residence is Storage Lifecycle Policy: no
Granular Restore Info: no
HW/OS/Client: Linux RedHat2.4 client1
Linux RedHat2.4 client2
Include: ALL_LOCAL_DRIVES
Schedule: full_backup
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Saturday, Week 2
Saturday, Week 3
Saturday, Week 4
Saturday, Week 5
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 01:15:00 --> Sunday 01:15:00
Schedule: monthly_full
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks) 10 (18 months)
Number Copies: 2
Fail on Error: 0 0
Residence: Staging quantum-lto5-i80
Volume Pool: NetBackup NetBackup
Server Group: *ANY* *ANY*
Calendar sched: Enabled
Saturday, Week 1
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 00:00:00 --> Sunday 08:00:00
Schedule: Cumulative-Inc
Type: Differential Incremental Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Monday, Week 1
Tuesday, Week 1
Wednesday, Week 1
Thursday, Week 1
Monday, Week 2
Tuesday, Week 2
Wednesday, Week 2
Thursday, Week 2
Monday, Week 3
Tuesday, Week 3
Wednesday, Week 3
Thursday, Week 3
Monday, Week 4
Tuesday, Week 4
Wednesday, Week 4
Thursday, Week 4
Monday, Week 5
Tuesday, Week 5
Wednesday, Week 5
Thursday, Week 5
EXCLUDE DATE 0 - 02/25/2010
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Monday 20:00:00 --> Tuesday 06:00:00
Tuesday 20:00:00 --> Wednesday 06:00:00
Wednesday 20:00:00 --> Thursday 06:00:00
Thursday 20:00:00 --> Friday 06:00:00
Policy Name: test_policy2
Policy Type: Standard
Active: yes
Effective date: 05/07/2003 11:58:43
Client Compress: no
Follow NFS Mounts: no
Cross Mount Points: no
Collect TIR info: no
Block Incremental: no
Mult. Data Streams: yes
Client Encrypt: no
Checkpoint: yes
Interval: 15
Policy Priority: 0
Max Jobs/Policy: Unlimited
Disaster Recovery: 0
Collect BMR info: no
Residence: Staging
Volume Pool: NetBackup
Server Group: *ANY*
Keyword: (none specified)
Data Classification: -
Residence is Storage Lifecycle Policy: no
Granular Restore Info: no
HW/OS/Client: Linux RedHat2.4 client3
Linux RedHat2.4 client4
Include: ALL_LOCAL_DRIVES
Schedule: full_backup
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Saturday, Week 2
Saturday, Week 3
Saturday, Week 4
Saturday, Week 5
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 01:15:00 --> Sunday 01:15:00
Schedule: monthly_full
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks) 10 (18 months)
Number Copies: 2
Fail on Error: 0 0
Residence: Staging quantum-lto5-i80
Volume Pool: NetBackup NetBackup
Server Group: *ANY* *ANY*
Calendar sched: Enabled
Saturday, Week 1
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 00:00:00 --> Sunday 08:00:00
Schedule: Cumulative-Inc
Type: Differential Incremental Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Monday, Week 1
Tuesday, Week 1
Wednesday, Week 1
Thursday, Week 1
Monday, Week 2
Tuesday, Week 2
Wednesday, Week 2
Thursday, Week 2
Monday, Week 3
Tuesday, Week 3
Wednesday, Week 3
Thursday, Week 3
Monday, Week 4
Tuesday, Week 4
Wednesday, Week 4
Thursday, Week 4
Monday, Week 5
Tuesday, Week 5
Wednesday, Week 5
Thursday, Week 5
EXCLUDE DATE 0 - 02/25/2010
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Monday 20:00:00 --> Tuesday 06:00:00
Tuesday 20:00:00 --> Wednesday 06:00:00
Wednesday 20:00:00 --> Thursday 06:00:00
Thursday 20:00:00 --> Friday 06:00:00
So to sum up the problem, I want to be able to display all of the clients in the policy and those clients should display the appropriate policy, schedule, etc.
I think my problem is just figuring out how to get it to loop before moving on to the next policy.
Any help would be greatly appreciated.
Thanks,
John
BEGIN{printf ("%-28s %-10s %-30s %-15s %-30s %-38s %-15s\n", "Policy", "Active", "Client", "OS", "Schedule", "Type", "Policy Type\n=========================================================
========================================================================================================================")}
/^Policy Name/{policy = $3}
/Policy Type:/{ptype = $3}
/Active/{active = $2}
/HW\/OS\/Client:/{os = $(NF-1); client = $NF}
/ Schedule:/{schedule = $2}
/ Type:/{type = $2" "$3" "$4; printf ("%-28s %-10s %-30s %-15s %-30s %-38s %-15s\n", policy, active, client, os, schedule, type, ptype)}
I tried changing the HW/OS/Client line to the one below, but that doesn't help.
/HW\/OS\/Client:/,/Include:/{os = $(NF-1); client = $NF}
The resulting output is something like this:
test_policy yes client1 Windows2000 monthly_full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Cumulative-Inc Cumulative Incremental Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 monthly_full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Differential Differential Incremental Backup MS-Windows-NT
The desired output is:
test_policy yes client1 Windows2000 monthly_full Full Backup MS-Windows-NT
test_policy yes client2 Windows2000 monthly_full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Full Full Backup MS-Windows-NT
test_policy yes client2 Windows2000 Full Full Backup MS-Windows-NT
test_policy yes client1 Windows2000 Cumulative-Inc Cumulative Incremental Backup MS-Windows-NT
test_policy yes client2 Windows2000 Cumulative-Inc Cumulative Incremental Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 monthly_full Full Backup MS-Windows-NT
test_policy2 yes client4 Windows2008 monthly_full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Full Full Backup MS-Windows-NT
test_policy2 yes client4 Windows2008 Full Full Backup MS-Windows-NT
test_policy2 yes client3 Windows2008 Differential Differential Incremental Backup MS-Windows-NT
test_policy2 yes client4 Windows2008 Differential Differential Incremental Backup MS-Windows-NT
The input file looks like this:
Policy Name: test_policy
Policy Type: Standard
Active: yes
Effective date: 05/07/2003 11:58:43
Client Compress: no
Follow NFS Mounts: no
Cross Mount Points: no
Collect TIR info: no
Block Incremental: no
Mult. Data Streams: yes
Client Encrypt: no
Checkpoint: yes
Interval: 15
Policy Priority: 0
Max Jobs/Policy: Unlimited
Disaster Recovery: 0
Collect BMR info: no
Residence: Staging
Volume Pool: NetBackup
Server Group: *ANY*
Keyword: (none specified)
Data Classification: -
Residence is Storage Lifecycle Policy: no
Granular Restore Info: no
HW/OS/Client: Linux RedHat2.4 client1
Linux RedHat2.4 client2
Include: ALL_LOCAL_DRIVES
Schedule: full_backup
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Saturday, Week 2
Saturday, Week 3
Saturday, Week 4
Saturday, Week 5
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 01:15:00 --> Sunday 01:15:00
Schedule: monthly_full
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks) 10 (18 months)
Number Copies: 2
Fail on Error: 0 0
Residence: Staging quantum-lto5-i80
Volume Pool: NetBackup NetBackup
Server Group: *ANY* *ANY*
Calendar sched: Enabled
Saturday, Week 1
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 00:00:00 --> Sunday 08:00:00
Schedule: Cumulative-Inc
Type: Differential Incremental Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Monday, Week 1
Tuesday, Week 1
Wednesday, Week 1
Thursday, Week 1
Monday, Week 2
Tuesday, Week 2
Wednesday, Week 2
Thursday, Week 2
Monday, Week 3
Tuesday, Week 3
Wednesday, Week 3
Thursday, Week 3
Monday, Week 4
Tuesday, Week 4
Wednesday, Week 4
Thursday, Week 4
Monday, Week 5
Tuesday, Week 5
Wednesday, Week 5
Thursday, Week 5
EXCLUDE DATE 0 - 02/25/2010
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Monday 20:00:00 --> Tuesday 06:00:00
Tuesday 20:00:00 --> Wednesday 06:00:00
Wednesday 20:00:00 --> Thursday 06:00:00
Thursday 20:00:00 --> Friday 06:00:00
Policy Name: test_policy2
Policy Type: Standard
Active: yes
Effective date: 05/07/2003 11:58:43
Client Compress: no
Follow NFS Mounts: no
Cross Mount Points: no
Collect TIR info: no
Block Incremental: no
Mult. Data Streams: yes
Client Encrypt: no
Checkpoint: yes
Interval: 15
Policy Priority: 0
Max Jobs/Policy: Unlimited
Disaster Recovery: 0
Collect BMR info: no
Residence: Staging
Volume Pool: NetBackup
Server Group: *ANY*
Keyword: (none specified)
Data Classification: -
Residence is Storage Lifecycle Policy: no
Granular Restore Info: no
HW/OS/Client: Linux RedHat2.4 client3
Linux RedHat2.4 client4
Include: ALL_LOCAL_DRIVES
Schedule: full_backup
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Saturday, Week 2
Saturday, Week 3
Saturday, Week 4
Saturday, Week 5
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 01:15:00 --> Sunday 01:15:00
Schedule: monthly_full
Type: Full Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks) 10 (18 months)
Number Copies: 2
Fail on Error: 0 0
Residence: Staging quantum-lto5-i80
Volume Pool: NetBackup NetBackup
Server Group: *ANY* *ANY*
Calendar sched: Enabled
Saturday, Week 1
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Saturday 00:00:00 --> Sunday 08:00:00
Schedule: Cumulative-Inc
Type: Differential Incremental Backup
Maximum MPX: 4
Synthetic: 0
PFI Recovery: 0
Retention Level: 1 (2 weeks)
Number Copies: 1
Fail on Error: 0
Residence: (specific storage unit not required)
Volume Pool: (same as policy volume pool)
Server Group: (same as specified for policy)
Calendar sched: Enabled
Allowed to retry after run day
Monday, Week 1
Tuesday, Week 1
Wednesday, Week 1
Thursday, Week 1
Monday, Week 2
Tuesday, Week 2
Wednesday, Week 2
Thursday, Week 2
Monday, Week 3
Tuesday, Week 3
Wednesday, Week 3
Thursday, Week 3
Monday, Week 4
Tuesday, Week 4
Wednesday, Week 4
Thursday, Week 4
Monday, Week 5
Tuesday, Week 5
Wednesday, Week 5
Thursday, Week 5
EXCLUDE DATE 0 - 02/25/2010
Residence is Storage Lifecycle Policy: 0
Daily Windows:
Monday 20:00:00 --> Tuesday 06:00:00
Tuesday 20:00:00 --> Wednesday 06:00:00
Wednesday 20:00:00 --> Thursday 06:00:00
Thursday 20:00:00 --> Friday 06:00:00
So to sum up the problem, I want to be able to display all of the clients in the policy and those clients should display the appropriate policy, schedule, etc.
I think my problem is just figuring out how to get it to loop before moving on to the next policy.
Any help would be greatly appreciated.
Thanks,
John