当前位置:Gxlcms >
数据库问题 >
Windows Server 脚本记录Apache、Mysql 每分钟并发数
Windows Server 脚本记录Apache、Mysql 每分钟并发数
时间:2021-07-01 10:21:17
帮助过:4人阅读
echo %
date:~
0,
4%%
date:~
5,
3%%
date:~
8,
6% %
time:~
0,
2%:%
time:~
3,
2%:%
time:~
6,
2% >
d:\monitor\apache\a
netstat -ant |
find /i
"ESTABLISHED"|
find /i
":80 " /c >
d:\monitor\apache\b
cd d:
cd monitor
cd apache
for /f
"tokens=*" %%i
in (a)
do (
set /a n+=
1
set #!n!=%%
i)
set n=
(for /f
"tokens=*" %%i
in (b)
do (
set /a n+=
1
call echo %%#!n!%%%%i))>>
apacheResult
del a b
cd C:\Program Files\MySQL\MySQL Server 5.6\bin
set user_mysql=
dbmonitor
set password_mysql=
dbPassword
mysql -u%user_mysql% -p%password_mysql% <
d:\monitor\mysql\sql.sql
echo %
date:~
0,
4%%
date:~
5,
2%%
date:~
8,
6% %
time:~
0,
2%:%
time:~
3,
2%:%
time:~
6,
2% >
d:\monitor\mysql\a
cd d:
cd monitor
cd mysql
for /f
"tokens=*" %%i
in (a)
do (
set /a n+=
1
set #!n!=%%
i)
set n=
(for /f
"tokens=*" %%i
in (b)
do (
set /a n+=
1
call echo %%#!n!%%%%i))>>
mysqlResult
del a b
:end
Monitor Code
备注:BAT脚本在计划任务中不执行,是计划任务设置有问题,若脚本未执行,请安装下图修改:
Windows Server 脚本记录Apache、Mysql 每分钟并发数
标签: