craftcas.blogg.se

Bash script to monitor cpu and memory usage
Bash script to monitor cpu and memory usage









bash script to monitor cpu and memory usage

What's the best way to see if our folks are actually using the record meeting option on teams? Have the analysis script parse the raw output every minute as well as reporting on it all. I used mine to identify a rogue cron job that ran overnight and messed up the archiving process.Īfterthought: In fact, given the problem of vmstat getting started at fixed intervals, I would probably change the above: With the history file, you can do other stuff. It also needs to prune the stats file every so often (maybe at midnight), and handle the email or SMS reporting, and maybe syslog the messages too, so it really cannot be doing the collections reliably as well. CPU 7 is now below 80% after being above 90% for 12 minutes. In fact, it should count way back so it can say stuff like: It would need to identify the last 10 appended rows, and count back how many of those were over or under 90%. (3) Have a separate script that analyses the accumulated data (because the vmstat script is stuck waiting for vmstat most of the time, and if you run the analysis in the same script there will be gaps in the collection). awk would be best for this by a wide margin. (2) Pick the important values out of the vmstat results and append them to a file. Do you have top on your system, and does it come with the option that snaps a report to stdout instead of writing to a terminal? And there might be a better tool than vmstat, but you have the man pages and I don't. I don't have AIX access any more, so you can post some output from that and we can take it from there. The -t timestamps the rows so you can see which is which. The second set is averaged for the 60 seconds between the first and second report. The first set (from my memory) is averages since boot time and must be ignored. This should get you two sets of details, 60 seconds apart.

bash script to monitor cpu and memory usage

(1) Run on a one-minute time: vmstat -t 60 2 Is there a different threshhold for going under, like 30%? Do you care about multiple CPUs or cores, or is this the whole server total only? Do you want to know if any single process is the majority culprit?

bash script to monitor cpu and memory usage bash script to monitor cpu and memory usage

Or do you want to know about the last ten minutes more frequently (e.g. Do you want to know about 90% over whole ten minute slots (e.g. You might want to tighten up the specification a little.











Bash script to monitor cpu and memory usage