
stumpd
Novice
Feb 23, 2013, 8:35 AM
Post #1 of 14
(4081 views)
|
Trying to sort output
|
Can't Post
|
|
Hey gurus! I have a question on how to sort some output so I can return the correct value. I have tried several different things, including "greping" for different words and trying to sort the output in that fashion, but the problem is based on the names of the volumes in the tape library sometimes the numbers I need to check against are on a different line. It was suggest to me to remove all the carriage returns, then somehow compare the output against the threshold of seconds. Which in this case is 1001. Let me show you the output:
Process Process Description Status Number -------- -------------------- ------------------------------------------------- 69 Backup Storage Pool Primary Pool TAPE_BACKUP, Copy Pool TAPE_OFFSITE, Files Backed Up: 36081, Bytes Backed Up: 27,770,282,615, Unreadable Files: 0, Unreadable Bytes: 0. Current Physical File (bytes): 8,409,734,275 Waiting for access to input volume 300082 (3116 seconds). Current output volume: 300724. 70 Backup Storage Pool Primary Pool TAPE_BACKUP, Copy Pool TAPE_OFFSITE, Files Backed Up: 39, Bytes Backed Up: 330,587,389,610, Unreadable Files: 0, Unreadable Bytes: 0. Current Physical File (bytes): 10,636,058,581 Current input volume: 300082. Current output volume: 300412. 71 Space Reclamation Offsite Volume(s) (storage pool TAPE_OFFSITE), Moved Files: 8401, Moved Bytes: 851,107,244, Unreadable Files: 0, Unreadable Bytes: 0. Current Physical File (bytes): 4,356,813 Waiting for access to input volume 300082 (1843 seconds). Current output volume: 300351. This is the output from a command ran on the AIX command line to get the current processes running in our backup utility. I need to return a value if wait seconds are above 1001. However, since the spacing of these outputs and carriage returns is dynamic based on the name of process waiting what I wrote using grep only works in certain situations and even then I am not sure I am evaluating the string correctly. I use "ge" to do that, which as I understand it, evaluates the numerical value of the string. It is my hope some awesome guru here knows a much better and easier way of doing this, because I am stumped!!! Thank you. Also I am going to add the code I currently use at the bottom here. Which does not work as it needs too. Thanks again!!!
#!/usr/bin/perl my $rundsm = "dsmadmc -id=reports -pa=reports q proc | grep Waiting"; my @output = `$rundsm`; my $string = "Waiting call (1001"; if (@output gt $string) { print "Message: Issue Found, Alert Operators\n"; print "Statistic: 1\n"; } else { print "Message: No Issues Found\n"; print "Statistic: 0\n"; } exit 0;
|