Hi all: I am looking for ideas on how to solve this problem.
In trying to troubleshoot a problem with an application, I want to include the prior 10 minutes of iostat info along with the report. I have the rules to detect the problem in the application but I am not sure how to capture/report the last 10 minutes of iostat info. When I was working with single line vmstat info, I could use this little action snippet: action = add $1_vmstat_data $0 ; \ getsize %size $1_vmstat_data; \ lcall %gt10 %size -> ( sub { $_[0] > 10 } ); \ while %gt10 ( shift $1_vmstat_data %discard; \ getsize %size $1_vmstat_data; \ lcall %gt10 %size -> ( sub { $_[0] > 10 } ); \ ) ; to trim the _vmstat_data down to just 10 lines. Since I am shifting off the old data and adding the new data I get the last 10 minutes. I would like to do the same with the iostat data, but it's multiline data and I don't know how many lines will be in the data (it depends on the command line values, how many disks are on the servers etc). I know each report will start with the "avg-cpu:" header line (but a different pid). iostat[26896]: avg-cpu: %user %nice %system %iowait %steal %idle iostat[26896]: 1.33 0.00 0.15 0.48 0.00 98.05 iostat[26896]: iostat[26896]: Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn iostat[26896]: sdc 92.15 7116.66 2915.91 158637856297 64998797929 iostat[26896]: sdb 5.88 1.75 1081.30 38910034 24103365344 iostat[26896]: sdd 68.13 18690.11 2497.23 416622358522 55666016464 iostat[26896]: sda 1.40 35.79 28.88 797836090 643783302 iostat[26896]: dm-0 0.32 6.70 0.35 149414746 7819728 iostat[26896]: dm-1 0.56 2.39 2.10 53243752 46759664 iostat[26896]: dm-2 0.06 0.44 0.48 9874906 10752024 iostat[26896]: dm-3 3.40 26.02 25.49 580007202 568158440 iostat[26896]: dm-4 0.06 0.23 0.46 5237498 10293136 iostat[26896]: I want just the most recent 10 of these to be stored. If I knew there was always 14 lines in the report, I could use the action above and just keep 140 lines but I don't know the number of lines. The ideas I have come up with are to break into perl and access the context either directly (in the associative array) or by "copy"ing the the context to an action variable and passing the variable into the perl function and manipulating the data by splitting on "avg-cpu:" keeping the last 10 and joining the results back together with avg-cpu" between them. I do lose a bit of info but... Another idea was to keep a rotating set of contexts as a circular buffer and just prepend all 10 contexts to the report. These will likely be out of order but at least the info is all there. But these are both lousy ideas. Does anybody have a better idea? -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions. ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ Simple-evcorr-users mailing list Simple-evcorr-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users