master
ps1 42 lines 989 Bytes
Raw
1
2 Function NetdataCopyConfig {
3 param ($dst, $src, $file)
4
5 Write-Host "Creating $file if it does not exist!"
6
7 $testDST = "$dst\$file"
8 $testSRC = "$src\$file"
9 if (-Not (Test-Path $testDST)) {
10 if (Test-Path $testSRC) {
11 robocopy /xc /xn /xo $src $dst $file
12 }
13 }
14 }
15
16 Function NetdataDownloadNetdataConfig {
17 param ($path)
18
19 Write-Host "Creating netdata.conf if it does not exist!"
20
21 $netdataConfPATH = "$path\netdata.conf"
22 $netdataConfURL = "http://localhost:19999/netdata.conf"
23 if (Test-Path $netdataConfPATH) {
24 exit 0
25 }
26
27 try {
28 Invoke-WebRequest $netdataConfURL -OutFile $netdataConfPATH
29 }
30 catch {
31 New-Item -Path "$netdataConfPATH" -ItemType File
32 }
33 }
34
35 $confPath = "C:\Program Files\Netdata\etc\netdata";
36 $stockStreamPath = "C:\Program Files\Netdata\usr\lib\netdata\conf.d";
37
38 NetdataCopyConfig $confPath $stockStreamPath "stream.conf"
39
40 NetdataDownloadNetdataConfig $confPath
41
42 exit 0;