The vmstat Command reports statistics about Kernel threads, virtual memory, disks, traps, and CPU activity. Reports generated by the vmstat command can be used to balance system load activities. The statistical information within the system range (in all processors) calculates the average value in percentage or calculates its sum.
Encountered a problem. The running status of the machine at night needs to be monitored. Use vmsata to save logs as files. The next day.
Method vmstat 60> a. log
Disadvantage: the specific time of each record cannot be displayed.
Solution. Write another script to the. log file at a scheduled time.
The script is as follows: a. sh
While:
Do
Echo 'date'> a. log
Sleep 600
Done
The final method. 1. Start the scheduled write time script nohup sh a. sh &
2. Start vmstat: nohup vmstat 60> a. log (here is a> Number)
####################
In addition, if you only need to monitor the load average, you can use the following script or use nohup to start it.
While:
Do
Echo 'date'> e.txt
Echo 'uptime'> e.txt
Sleep 60
Done
---- End ----