master
bat 59 lines 1.46 KB
Raw
1 @echo off
2 setlocal enabledelayedexpansion
3
4 set "MAN_SRC=%~dp0wevt_netdata_manifest.xml"
5 set "DLL_SRC=%~dp0wevt_netdata.dll"
6 set "DLL_DST=%SystemRoot%\System32\wevt_netdata.dll"
7
8 where wevtutil >nul 2>nul
9 if %errorlevel% neq 0 (
10 echo Error: wevtutil.exe not found in PATH.
11 exit /b 1
12 )
13
14 echo.
15 echo Uninstalling previous manifest (if any)...
16 wevtutil um "%MAN_SRC%"
17
18 echo.
19 echo Copying %DLL_SRC% to %DLL_DST%
20 copy /y "%DLL_SRC%" "%DLL_DST%"
21 if %errorlevel% neq 0 (
22 echo Error: Failed to copy %DLL_SRC% to %DLL_DST%
23 exit /b 1
24 )
25
26 echo.
27 echo Granting access to %DLL_DST% for Windows Event Logging...
28 icacls "%DLL_DST%" /grant "NT SERVICE\EventLog":R
29 if %errorlevel% neq 0 (
30 echo Error: Failed to grant access to %DLL_DST%.
31 exit /b 1
32 )
33
34 echo.
35 echo Importing the manifest...
36 wevtutil im "%MAN_SRC%" /rf:"%DLL_DST%" /mf:"%DLL_DST%"
37 if %errorlevel% neq 0 (
38 echo Error: Failed to import the manifest.
39 exit /b 1
40 )
41
42 echo.
43 echo Verifying Netdata Publisher for Event Tracing for Windows (ETW)...
44 wevtutil gp "Netdata"
45 if %errorlevel% neq 0 (
46 echo Error: Failed to get publisher Netdata.
47 exit /b 1
48 )
49
50 echo.
51 echo Setting default event sizes...
52 wevtutil sl "Netdata/Daemon" /ms:104857600
53 wevtutil sl "Netdata/Collectors" /ms:104857600
54 wevtutil sl "Netdata/Health" /ms:104857600
55 wevtutil sl "Netdata/Access" /ms:104857600
56
57 echo.
58 echo Netdata Event Tracing for Windows manifest installed successfully.
59 exit /b 0