Guest User

Untitled

a guest
Jan 1st, 2021
103
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2.  
  3. from icmplib import ping, multiping, traceroute, resolve, Host, Hop
  4. from datetime import datetime
  5. from influxdb_client import InfluxDBClient, Point, WritePrecision
  6. from influxdb_client.client.write_api import SYNCHRONOUS
  7.  
  8. token = "YOUR_TOKEN_HERE_INFLUXDB"
  9. org = "apollo"
  10. bucket = "uptime"
  11. client = InfluxDBClient(url="http://192.168.1.52:8086", token=token)
  12. write_api = client.write_api(write_options=SYNCHRONOUS)
  13.  
  14. while True:
  15.     for x in range(256):
  16.         response = ping('192.168.1.'+str(x),count=1,privileged=True,timeout=0.05)
  17.         if response.is_alive==True:
  18.             point = Point("uptime")\
  19.                 .tag("IP", '192.168.1.'+str(x))\
  20.                 .field("Avg_RTT", response.avg_rtt)\
  21.                 .time(datetime.utcnow(), WritePrecision.NS)
  22.             write_api.write(bucket, org, point)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×