Switch branches/tags
Nothing to show
Find file Copy path
39ce9b1 Nov 4, 2018
0 contributors

Users who have contributed to this file

55 lines (47 sloc) 2.5 KB
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
### Set Local Admin Password
$admin = [adsi]("WinNT://./administrator, user")
$admin.psbase.invoke("SetPassword", "${admin_password}")
### Install non-sucking service manager
choco install -y nssm
### Install and configure Grafana
Set-Location C:\
Invoke-WebRequest${grafana_version} -OutFile
Expand-Archive C:\
Get-Item C:\Grafana\Grafana* | Rename-Item -NewName Grafana
$GrafanaConfig = 'C:\Grafana\Grafana\conf\defaults.ini'
(Get-Content $GrafanaConfig).Replace('http_port = 3000','http_port = ${grafana_port}') | Set-Content $GrafanaConfig
New-NetFirewallRule -DisplayName "Grafana" -Direction Inbound -Action Allow -LocalPort ${grafana_port} -Protocol TCP
nssm install Grafana "C:\Grafana\Grafana\bin\grafana-server.exe"
Start-Service Grafana
### Install and configure Influx
Set-Location C:\
Invoke-WebRequest${influx_version} -OutFile
Expand-Archive C:\
Get-Item C:\Influx\InfluxDB* | Rename-Item -NewName InfluxDB
$InfluxConfig = 'C:\Influx\InfluxDB\influxdb.conf'
(Get-Content $InfluxConfig).Replace('# bind-address = ":8086"','bind-address = ":${influx_port}"') | Set-Content $InfluxConfig
New-NetFirewallRule -DisplayName "Influx" -Direction Inbound -Action Allow -LocalPort ${influx_port} -Protocol TCP
nssm install InfluxDB "C:\Influx\InfluxDB\influxd.exe" """-config C:\Influx\InfluxDB\influxdb.conf"""
Start-Service InfluxDB
C:\Influx\InfluxDB\influx.exe -execute 'CREATE DATABASE ${influx_database}'
if (${enable_udp_listener} -eq $true) {
$UDPConfig = @"
enabled = true
bind-address = ":${influx_udp_port}"
database = "${influx_udp_database}"
batch-size = 5000
batch-timeout = "1s"
batch-pending = 10
read-buffer = 0
Add-Content -Path $InfluxConfig -Value $UDPConfig
New-NetFirewallRule -DisplayName "InfluxUDP" -Direction Inbound -Action Allow -LocalPort ${influx_udp_port} -Protocol UDP
C:\Influx\InfluxDB\influx.exe -execute 'CREATE DATABASE ${influx_udp_database}'
Restart-Service InfluxDB