Windows Server script Records Apache, Mysql concurrency per minute

Source: Internet
Author: User

Open Windows Server Scheduled Task Manager. Execute the following bat script at timed intervals.

Create a new monitor folder on the D drive, creating a Apachemysql.bat file. The contents are as follows:

Create a new MySQL, Apache folder in the Monitor folder

Go to the MySQL folder, create the Sql.sql file, and save the following:

Select COUNT (*) from information_schema.processlist to outfile ' d:/monitor/mysql/b ';

After execution, the script generates a log file. Records the current time and the current number of concurrent, saved in the respective folder.

@echo offsetlocal enabledelayedexpansionEcho%Date:~0,4%%Date:~5,3%%Date:~8,6% % Time:~0,2%:% Time:~3,2%:% Time:~6,2% >D:\monitor\apache\anetstat-ant |Find/I"established"|Find/I":"/C >D:\MONITOR\APACHE\BCD d:cd monitorcd Apache for/F"tokens=*"%%iinch(a) Do(Set/A n+=1Set #!n!=%%i) set n=( for/F"tokens=*"%%iinch(b) Do(Set/A n+=1PagerEcho%%#!n!%%%%i)) >>Apacheresultdel a BCD C:\Program files\mysql\mysql Server5.6\binset User_mysql=Dbmonitorset Password_mysql=Dbpasswordmysql-u%user_mysql%-p%password_mysql% <D:\monitor\mysql\sql.sqlEcho%Date:~0,4%%Date:~5,2%%Date:~8,6% % Time:~0,2%:% Time:~3,2%:% Time:~6,2% >d:\monitor\mysql\acd d:cd monitorcd MySQL for/F"tokens=*"%%iinch(a) Do(Set/A n+=1Set #!n!=%%i) set n=( for/F"tokens=*"%%iinch(b) Do(Set/A n+=1PagerEcho%%#!n!%%%%i)) >>Mysqlresultdel a b:end
Monitor Code

Note: The bat script does not execute in the scheduled task, is a problem with the scheduled task settings, if the script is not executed, install the modification:

Windows Server script Records Apache, Mysql concurrency per minute

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.