====== How can I measure the availability of my routers? ====== Of course you can setup a Network Monitoring Tool (NMS) such as [[http://www.zabbix.com | Zabbix]]. An easier and faster way is to run the following [[wp>Windows_PowerShell|Windows PowerShell]] script and then analyze the results with Excel. $hosts += "IP or DynDNS Name of my Routers" $fname = "results.csv" while($true) { $date = Get-Date -format G $newtime = Get-Date -format t # if ( $newtime -gt $time ) { if ( $true ) { $time = $newtime if ($hosts -isnot [system.array]) { $hosts = Get-Content $hosts } $hosts | Foreach-Object { $pinghost = $_ $psObject = $null $psObject = New-Object psobject Add-Member -InputObject $psobject -MemberType NoteProperty -Name "Date" -Value $date Add-Member -InputObject $psobject -MemberType NoteProperty -Name "Host" -Value $pinghost $status = Test-Connection –count 1 $pinghost -ErrorAction SilentlyContinue if ($status.statuscode -eq 0) { $psobject | Add-Member -MemberType NoteProperty -Name "IP" -Value $status.IPV4Address $psobject | Add-Member -MemberType NoteProperty -Name "ResponseTime" -Value $status.ResponseTime $psobject | Add-Member -MemberType NoteProperty -Name "State" -Value "up" $psObject | Export-Csv $fname -Encoding UTF8 -Delimiter ";" -Append -NoTypeInformation Write-Host $psObject } else { $status2 = Test-Connection –count 1 $pinghost -ErrorAction SilentlyContinue if ($status2.statuscode -eq 0) { $psobject | Add-Member -MemberType NoteProperty -Name "IP" -Value $status2.IPV4Address $psobject | Add-Member -MemberType NoteProperty -Name "ResponseTime" -Value $status2.ResponseTime $psobject | Add-Member -MemberType NoteProperty -Name "State" -Value "up" $psObject | Export-Csv $fname -Encoding UTF8 -Delimiter ";" -Append -NoTypeInformation Write-Host $psobject -ForegroundColor black -BackgroundColor green } else { $psobject | Add-Member -MemberType NoteProperty -Name "IP" -Value ="n/a" $psobject | Add-Member -MemberType NoteProperty -Name "ResponseTime" -Value "-100" $psobject | Add-Member -MemberType NoteProperty -Name "State" -Value "down" $psObject | Export-Csv $fname -Encoding UTF8 -Delimiter ";" -Append -NoTypeInformation Write-Host $psobject -BackgroundColor Red } } } } Write-Host "wait another 5 seconds for for next check ..." Start-Sleep 5 }