How to stop collectl recursion?? restarting?

235 Views Asked by At

I am currently using collectl to monitor my system usage. At the same time, I have a shell script that tail this and logs output.

collectl >> test.file
while true; do tail test.file; done

But it seems like collectl is restarting (I might be wrong) at every 22 lines of output and puts

<--------CPU--------><--------Disks--------><--------Network--------> this line..

http://imgur.com/44fY9Pl

So, I am wondering if there is a way to stop collectl to generate those line and put the value continuously? I looked in /etc/init.d/collectl but I was not able to modify anything

Thank you

2

There are 2 best solutions below

0
On BEST ANSWER

Yes you can disable header or just print it only once.
From man page;

--hr, --headerrepeat num Sets the number of intervals to display data for before repeating the header. A value -1 will prevent any headers from being displayed and a value of 0 will cause only a single header to be displayed and never repeated.

0
On

I've gotta ask, what are you trying to do? If you're looking for the latest data you're far better off utilizing collectl's functionality for this. For example, you can simply run collectl with -P --rawtoo and you'll get not only the raw file but a second one in plot format which you can easily tail.

Also note by writing the output of collectl to an unformatted file of your choosing you lose the ability to ever look at different slices of data or use colplot to visualize it. For example, if you use collectl as you're showing, you see average cpu load, total disk load and total network traffic. But what if you want to go back and investigate a spike in CPU and see it's distributed across all of them or if one is pegged at 100%? You'll never be able to tell.

If you can be more specific about what your goal is I can probably help you get there as I've already added just about every capability more people would ever need.

-mark