1

I'm not much familiar with Linux. So, it might be an easy question for everyone else. When we run top c command - we get average waiting time(wa) on server for current state. I need to know how much average waiting time for last 1 month. Any way to get this information?

2 Answers 2

1

You'd need to periodically record that information and preserve it over a period of one month.

There are some tools that do that resource usage tracking like sysstat or atop.

With atop on Debian at least, information sampled on a 10 minute basis is stored in daily log files in /var/log/atop.

The information about global CPU usage can be queried with

atop -r /path/to/log/file -PCPU

The atop man page gives you a description of that output, you'll find that for each line, the 6th field reports the number of seconds in the period, 7th number of CPU ticks per second and 13th the number of wait ticks.

So assuming GNU tools, you could do:

start=$(date -d '1 month ago' +%s)
find /var/log/atop -maxdepth 1 -name 'atop_[0-9]*' \
  -newermt "@$start" -exec atop -r {} -PCPU \; |
  awk -v start="$start" '
    $3 >= start {t += $6 * $7; w += $13}
    END {printf "%.2f%%\n", w * 100 / t}'
0

You should be able to monitor system performance for longer periods with sysstat, sar,...

Look up for these programs on internet. Here is one link for start: https://www.thegeekstuff.com/2011/03/sar-examples/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .