-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
6,392 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools | ||
Enable-WindowsOptionalFeature -Online -FeatureName "VirtualMachinePlatform" -NoRestart | ||
Restart-Computer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# ------------------ Configure Networking ---------------------- # | ||
# Create Virtual Switch | ||
New-VMSwitch -Name "Default Switch" -SwitchType Internal | ||
|
||
#Get Index | ||
$InterfaceIndex = (Get-NetAdapter -Name "vEthernet (Default Switch)").ifIndex | ||
|
||
do { | ||
Start-Sleep -Seconds 10 | ||
$IPAddress = (Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex $InterfaceIndex).IPAddress | ||
} while($null -eq $IPAddress) | ||
|
||
# Configure other IPs | ||
$octets = $IPAddress -split "\." | ||
$octets[3] = 1 | ||
$GatewayIP = $octets -join "." | ||
$octets[3] = 0 | ||
$NatIP = $octets -join "." | ||
$octets[3] = 100 | ||
$StartIP = $octets -join "." | ||
$octets[3] = 200 | ||
$EndIP = $octets -join "." | ||
$InternalIPInterfaceAddressPrefix = $NatIP + "/24" | ||
|
||
# Set Gateway IP Address | ||
New-NetIPAddress -IPAddress $GatewayIP -PrefixLength 24 -InterfaceIndex $InterfaceIndex | ||
|
||
# Create Nat | ||
New-NetNat -Name "Default Switch" -InternalIPInterfaceAddressPrefix $InternalIPInterfaceAddressPrefix | ||
|
||
# Install DHCP Server | ||
Install-WindowsFeature -Name 'DHCP' -IncludeManagementTools | ||
|
||
# Add | ||
netsh dhcp add securitygroups | ||
Restart-Service dhcpserver | ||
|
||
# Add the DHCP Server to the default local security groups and restart the server. | ||
Add-DhcpServerV4Scope -Name "AzureIoTEdgeScope" -StartRange $StartIP -EndRange $EndIP -SubnetMask 255.255.255.0 -State Active | ||
|
||
# Assign the NAT and gateway IP addresses you created in the earlier section to the DHCP server, and restart the server to load the configuration. | ||
Set-DhcpServerV4OptionValue -ScopeID $NatIP -Router $GatewayIP | ||
Restart-service dhcpserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
param( | ||
[string]$CONNECTION_STRING | ||
) | ||
|
||
# ------------------ EFLOW ---------------------- # | ||
#Run each of the following commands to download IoT Edge for Linux on Windows | ||
$msiPath = $([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi')) | ||
$ProgressPreference = 'SilentlyContinue' | ||
Invoke-WebRequest "https://aka.ms/AzEFLOWMSI-CR-X64" -OutFile $msiPath | ||
|
||
#Install IoT Edge for Linux on Windows on your device. | ||
Start-Process -Wait msiexec -ArgumentList "/i","$([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))","/qn" | ||
|
||
#Create Linux virtual machine and installs the IoT Edge runtime for you. | ||
Deploy-Eflow -acceptEula yes -acceptOptionalTelemetry no | ||
|
||
# Provision EFLOW | ||
Provision-EflowVm -provisioningType ManualConnectionString -devConnString $CONNECTION_STRING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copy pn.json file to EFLOW VM | ||
Invoke-EflowVmCommand "mkdir -p opcconfig" | ||
Copy-EflowVMFile -fromFile "opcconfig.json" -toFile ~\opcconfig\opcconfig.json -pushFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
opc_raw | ||
| order by SourceTimestamp desc | ||
| take 100 | ||
|
||
telemetry | ||
| order by SourceTimestamp desc | ||
| take 100 | ||
|
||
// Plot all Sensors in all Lines | ||
// Last 1 hours with 1 minute grouping | ||
let _startTime = now()-1h; | ||
let _endTime = now(); | ||
telemetry | ||
| make-series num=avg(tolong(Value)) default=0 on SourceTimestamp in range(_startTime, _endTime, 1m) by ExpandedNodeId | ||
| render timechart | ||
|
||
|
||
// Plot all Sensors in Line 1 | ||
let _startTime = now()-1hr; | ||
let _endTime = now(); | ||
let temptags = telemetry | ||
| distinct ExpandedNodeId | ||
| where ExpandedNodeId contains ("Line1") | ||
| project ExpandedNodeId; | ||
telemetry | ||
| where ExpandedNodeId in (temptags) | ||
| project | ||
SourceTimestamp, Tag = replace_string(ExpandedNodeId,"nsu=KEPServerEX;s=Simulator.Line1.",""), | ||
yaxis = todouble(Value) | ||
| make-series num=avg(yaxis) default=0 on SourceTimestamp in range(_startTime,_endTime, 1m) by Tag | ||
| render timechart | ||
|
||
|
||
|
||
// Plot all Humidity Sensors | ||
// Last 30 minutes with 10 second grouping | ||
let _startTime = now()-30m; | ||
let _endTime = now(); | ||
let temptags = telemetry | ||
| distinct ExpandedNodeId | ||
| where ExpandedNodeId contains ("Humidity") | ||
| project ExpandedNodeId; | ||
telemetry | ||
| where ExpandedNodeId in (temptags) | ||
| project SourceTimestamp, ExpandedNodeId, yaxis = todouble(substring(Value,0,2)) | ||
| make-series num=avg(yaxis) default=0 on SourceTimestamp in range(_startTime, _endTime, 10s) by ExpandedNodeId | ||
| render timechart | ||
|
||
|
||
// Management Queries | ||
|
||
.show ingestion failures |
Oops, something went wrong.