Delete Scripts/PingTo-InfluxDB.ps1

This commit is contained in:
Alex Kup 2023-10-14 12:03:37 +03:00 committed by GitHub
parent b284815b9c
commit 77c29d39d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +0,0 @@
while ($true) {
$tz = (Get-TimeZone).BaseUtcOffset.TotalMinutes
$unixtime = (New-TimeSpan -Start (Get-Date "01/01/1970") -End ((Get-Date).AddMinutes(-$tz))).TotalSeconds # -3h UTC
$timestamp = ([string]$unixtime -replace "\..+") + "000000000"
$tnc = tnc 8.8.8.8
$Status = $tnc.PingSucceeded
$RTime = $tnc.PingReplyDetails.RoundtripTime
Invoke-RestMethod -Method POST -Uri "http://192.168.3.104:8086/write?db=powershell" -Body "ping,host=$(hostname) status=$status,rtime=$RTime $timestamp"
sleep 1
}