All scripts are here. Firts create HTML page containing <IMG> tags calling graphs generators. Second script is graph generator itself. Antivirus is bouilt-in windows defender, batwrap.exe is listed in excluded processes. Just trying test with antivirus real-time monitoring turned off, but same results... Third scripts is just for completeness
@echo off
::
:: This script print html page and call 'TRAFFIC_graph_creator.cmd' to print traffic
:: on selected interfaces of specific routers
::
echo Content-Type: text/html
echo.
echo ^<!doctype html^>
echo ^<html^>
echo ^<head^>
echo ^<meta http-equiv="Content-Type" content="text/html; charset=utf-8"^>
echo ^<title^>
echo Traffic statistics
echo ^</title^>
echo ^</head^>
echo ^<body^>^<font size="5"^>^<table^>
set "host=10.10.0.5"
set "iface=vlan206"
echo ^<tr^>^<td^> [%iface%@%host%]:^</td^>^</tr^>
echo ^<tr^>^<td background="images/message.gif" style="background-repeat:no-repeat;background-position:center;"^>^<img src="TRAFFIC_graph_creator.cmd?host=%host%&iface=%iface%" width="1066" height="355"^>^</td^>^</tr^>
set "host=10.10.0.1"
set "iface=vlan4091"
echo ^<tr^>^<td^> [%iface%@%host%]:^</td^>^</tr^>
echo ^<tr^>^<td background="images/message.gif" style="background-repeat:no-repeat;background-position:center;"^>^<img src="TRAFFIC_graph_creator.cmd?host=%host%&iface=%iface%" width="1066" height="355"^>^</td^>^</tr^>
set "host=10.10.0.9"
set "iface=eth0.401"
echo ^<tr^>^<td^> [%iface%@%host%]:^</td^>^</tr^>
echo ^<tr^>^<td background="images/message.gif" style="background-repeat:no-repeat;background-position:center;"^>^<img src="TRAFFIC_graph_creator.cmd?host=%host%&iface=%iface%" width="1066" height="355"^>^</td^>^</tr^>
set "host=10.10.0.2"
set "iface=eth4.311"
echo ^<tr^>^<td^> [%iface%@%host%]:^</td^>^</tr^>
echo ^<tr^>^<td background="images/message.gif" style="background-repeat:no-repeat;background-position:center;"^>^<img src="TRAFFIC_graph_creator.cmd?host=%host%&iface=%iface%" width="1066" height="355"^>^</td^>^</tr^>
echo ^</font^>^</body^>^</html^>
@echo off
::
:: This script print create traffic graph from RRDfiles, based on 'host' and 'iface'
:: given in parameters. Output is controlled by REMOTE_ADDR variable presence.
::
::
echo Content-Type: image/png
echo.
set "rrdtool=c:\inetpub\monitoring_test\utilities\rrdtool\rrdtool.exe"
set "logfile=logs\%~n0.log"
REM == If started from console, check parameters presence ======================
if not defined REMOTE_ADDR (
set "output=c:\inetpub\monitoring_test\temp\graph.png"
if "%~2"=="" (
echo "Parameter missing. Usage: %~nx0 [host] [iface]"
exit /B
) else (
set "iface=%~2"
if not "%~1"=="" (
set "host=%~1"
) else (
echo "Parameter missing. Usage %~nx0 [host] [iface]"
exit /B
)
)
) else (
call "functions\read_POST.cmd" "%QUERY_STRING%"
set "output=-"
)
::
call :print_graph
exit /B
:print_graph
%rrdtool% ^
graph %output% ^
-w 1000 ^
-h 300 ^
-i ^
--disable-rrdtool-tag ^
--imgformat PNG ^
--end=-300 ^
--start=-115000 ^
DEF:traf1=X\:\RRD\ROUTERS\%host%\%iface%.rrd:traf1:AVERAGE ^
DEF:traf2=X\:\RRD\ROUTERS\%host%\%iface%.rrd:traf2:AVERAGE ^
CDEF:traf1_=traf1,-8,* ^
CDEF:traf2_=traf2,8,* ^
AREA:traf1_#00eb0c:"Traffic 1" ^
AREA:traf2_#1000ff:"Traffic 2" 2>>%logfile%
GOTO:EOF
::
:: This function read STDIN (http GET string), perform URLDecode and convert
:: encoding to UTF-8. If any parameter provided, parse it instead of script STDIN
::
:: require: win_iconv.exe
::
::
::
if "%~1"=="" (
REM == If no parameter provided, parse script STDIN [usually HTTP GET]
for /f "tokens=1-26 delims=&" %%a in ('
powershell.exe -noprofile "Add-Type -AssemblyName System.Web;[System.Web.HttpUtility]::UrlDecode($Input) | Write-Host" ^| win_iconv -f CP852 -t UTF-8
') do (
if not "%%~a"=="" set "%%~a"
if not "%%~b"=="" set "%%~b"
if not "%%~c"=="" set "%%~c"
if not "%%~d"=="" set "%%~d"
if not "%%~e"=="" set "%%~e"
if not "%%~f"=="" set "%%~f"
if not "%%~g"=="" set "%%~g"
if not "%%~h"=="" set "%%~h"
if not "%%~i"=="" set "%%~i"
if not "%%~j"=="" set "%%~j"
if not "%%~k"=="" set "%%~k"
if not "%%~l"=="" set "%%~l"
if not "%%~m"=="" set "%%~m"
if not "%%~n"=="" set "%%~n"
if not "%%~o"=="" set "%%~o"
if not "%%~p"=="" set "%%~p"
if not "%%~q"=="" set "%%~q"
if not "%%~r"=="" set "%%~r"
if not "%%~s"=="" set "%%~s"
if not "%%~t"=="" set "%%~t"
if not "%%~u"=="" set "%%~u"
if not "%%~v"=="" set "%%~v"
if not "%%~w"=="" set "%%~w"
if not "%%~x"=="" set "%%~x"
if not "%%~y"=="" set "%%~y"
if not "%%~z"=="" set "%%~z"
if not defined REMOTE_ADDR echo %~nx0_out --- TOKENS "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" "%%~i" "%%~j" "%%~k" "%%~l" "%%~m" "%%~n" "%%~o" "%%~p" "%%q" "%%~r" "%%~s" "%%~t" "%%~u" "%%~v" "%%w" "%%~x" "%%~y" "%%~z"
)
) else (
REM == If parameter provided, send it to STDIN to be parsed [usually console DEBUG]
REM == [Echoed strind HAVE to be doublequoted, othervise delimiters '=' diasppaer]
for /f "tokens=1-26 delims=#&" %%a in ('
echo "%~1"^| powershell.exe -noprofile "Add-Type -AssemblyName System.Web;[System.Web.HttpUtility]::UrlDecode($Input) | Write-Host" ^| win_iconv -f CP852 -t UTF-8
') do (
if not "%%~a"=="" set "%%~a"
REM == Missing trailing doublequote is an intend [hack od remaining one from echo "%~1"]
if not "%%~b"=="" set "%%~b
if not "%%~c"=="" set "%%~c"
if not "%%~d"=="" set "%%~d"
if not "%%~e"=="" set "%%~e"
if not "%%~f"=="" set "%%~f"
if not "%%~g"=="" set "%%~g"
if not "%%~h"=="" set "%%~h"
if not "%%~i"=="" set "%%~i"
if not "%%~j"=="" set "%%~j"
if not "%%~k"=="" set "%%~k"
if not "%%~l"=="" set "%%~l"
if not "%%~m"=="" set "%%~m"
if not "%%~n"=="" set "%%~n"
if not "%%~o"=="" set "%%~o"
if not "%%~p"=="" set "%%~p"
if not "%%~q"=="" set "%%~q"
if not "%%~r"=="" set "%%~r"
if not "%%~s"=="" set "%%~s"
if not "%%~t"=="" set "%%~t"
if not "%%~u"=="" set "%%~u"
if not "%%~v"=="" set "%%~v"
if not "%%~w"=="" set "%%~w"
if not "%%~x"=="" set "%%~x"
if not "%%~y"=="" set "%%~y"
if not "%%~z"=="" set "%%~z"
if not defined REMOTE_ADDR echo %~nx0_out --- TOKENS "%%~a" "%%~b" "%%~c" "%%~d" "%%~e" "%%~f" "%%~g" "%%~h" "%%~i" "%%~j" "%%~k" "%%~l" "%%~m" "%%~n" "%%~o" "%%~p" "%%q" "%%~r" "%%~s" "%%~t" "%%~u" "%%~v" "%%w" "%%~x" "%%~y" "%%~z"
)
)
exit /B