Linux Vmstat action record saved as file

Source: Internet
Author: User
Tags sleep


Encountered a problem. The operation of the machine at night needs to be monitored. Use Vmsata to save the log as a file. Look the next day.

Method Vmstat >a.log

Disadvantage: Unable to display the specific time of each record.

Workaround. Write another script to write time to the A.log file

The script is as follows a.sh

While:
Todo
echo ' Date ' >>a.log
Sleep 600
Done

The final method. 1. First start timed write time script nohup sh a.sh &

2. Start Vmstat:nohup Vmstat >a.log (mainly here is a > number)

####################

Add if only monitor load average can use the following script, also use Nohup to start

While:
Todo
echo ' Date ' >>e.txt
echo ' Uptime ' >>e.txt
Sleep 60
Done

----END----

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.