|
|
楼主 |
发表于 2013-12-5 12:03:19
|
显示全部楼层
已经缺人删除掉就可以了。定时任务暂时也没问题
另外我又添加了其它几种资源的统计。但是测试时好像只有第一个agent资源统计能生效
是不是需要在批处理中另外开启窗口来执行这个动作?
下面是我修改的脚本。有空的话能帮我审查下吗?
1 @echo off &color 0a &setlocal enabledelayedexpansion
2 pushd "%cd%"
3 rem 设置变量
4 set /a "a=b=c=d=e=f=g=h=i=j=0"
5 set Tm=300
6 :main
7 rem 生成资源文件
8 sures sures >sures.txt
9 if not exist sures.txt (msg %username% /time:5 "错误!!未找到 sures.txt 文件!!!" &call exit)
10 rem 生成agent资源使用情况统计文件
11 if not exist "agent.txt" (echo.日期 时间 机器名 Agent使用数量/Agent空余数量)>"Agent.txt"
12 for /f "delims=" %%a in ('findstr /i /c:"_12 RES IN USE" "sures.txt" 2^>nul') do (set /a "a+=1")
13 for /f "delims=" %%a in ('findstr /i /c:"_12 RES AVAILABLE" "sures.txt" 2^>nul') do (set /a "b+=1")
14 (@echo.!date! !time! %computername% !a!^/!b!)>>"Agent.txt"
15 type "Agent.txt"
16 ping localhost -n %TM% >nul
17 rem 生成电话资源使用情况统计文件
18 if not exist "Telephony.txt" (echo.日期 时间 机器名 电话使用数量/电话空余数量)>"Agent.txt"
19 for /f "delims=" %%a in ('findstr /i /c:"_8 RES IN USE" "sures.txt" 2^>nul') do (set /a "c+=1")
20 for /f "delims=" %%a in ('findstr /i /c:"_8 RES AVAILABLE" "sures.txt" 2^>nul') do (set /a "d+=1")
21 (@echo.!date! !time! %computername% !c!^/!d!)>>"Telephony.txt"
22 type "Telephony.txt"
23 ping localhost -n %TM% >nul
24 rem 生成动态库使用情况统计文件
25 if not exist "Ntdll.txt" (echo.日期 时间 机器名 动态库使用数量/动态库空余数量)>"Ntdll.txt"
26 for /f "delims=" %%a in ('findstr /i /c:"_15 RES IN USE" "sures.txt" 2^>nul') do (set /a "e+=1")
27 for /f "delims=" %%a in ('findstr /i /c:"_15 RES AVAILABLE" "sures.txt" 2^>nul') do (set /a "f+=1")
28 (@echo.!date! !time! %computername% !c!^/!d!)>>"Ntdll.txt"
29 type "Ntdll.txt"
30 ping localhost -n %TM% >nul
31 rem 生成数据库使用情况统计文件
32 if not exist "database.txt" (echo.日期 时间 机器名 数据库使用数量/数据库空余数量)>"database.txt"
33 for /f "delims=" %%a in ('findstr /i /c:"_4 RES IN USE" "sures.txt" 2^>nul') do (set /a "g+=1")
34 for /f "delims=" %%a in ('findstr /i /c:"_4 RES AVAILABLE" "sures.txt" 2^>nul') do (set /a "h+=1")
35 (@echo.!date! !time! %computername% !c!^/!d!)>>"database.txt"
36 type "database.txt"
37 ping localhost -n %TM% >nul
38 rem 生成SOAP使用情况统计文件
39 if not exist "soap.txt" (echo.日期 时间 机器名 SOAP使用数量/SOAP空余数量)>"soap.txt"
40 for /f "delims=" %%a in ('findstr /i /c:"_50 RES IN USE" "sures.txt" 2^>nul') do (set /a "i+=1")
41 for /f "delims=" %%a in ('findstr /i /c:"_50 RES AVAILABLE" "sures.txt" 2^>nul') do (set /a "j+=1")
42 (@echo.!date! !time! %computername% !c!^/!d!)>>"soap.txt"
43 type "soap.txt"
44 ping localhost -n %TM% >nul
45 del/Q sures.txt
46 cls &goto :main |
|