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