add pode and api scripts
This commit is contained in:
		
							parent
							
								
									30a3d7711e
								
							
						
					
					
						commit
						94bc297ea1
					
				
					 20 changed files with 783 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								API/PingTo-InfluxDB.ps1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								API/PingTo-InfluxDB.ps1
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| 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 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue