Guest User

Untitled

a guest
Oct 6th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #!/usr/bin/python3
  2. ###############################################
  3. # Copyright by IT Stall (www.itstall.de) 2018 #
  4. # Author: Dennis Eisold #
  5. # Created: 05.10.2018 #
  6. ###############################################
  7.  
  8. import datetime, time, json, subprocess, sys, time, argparse
  9. from influxdb import InfluxDBClient
  10.  
  11. influx_host = "YOUR IP"
  12. influx_user = "pixelflut"
  13. influx_pass = "pixelflut"
  14. influx_db = "pixelflut"
  15. influx_port = 8086
  16.  
  17. parser = argparse.ArgumentParser(description='Pixelflut to InfluxDB.')
  18. parser.add_argument('--rx', help='RX Bandwith')
  19. parser.add_argument('--tx', help='TX Bandwith')
  20. parser.add_argument('--mp', help='MegaPixel')
  21. parser.add_argument('--ps', help='P/S')
  22. parser.add_argument('--debug', default=False, help='Debug true/false')
  23. args = parser.parse_args()
  24.  
  25. if(args.debug):
  26. print("write to influxDB: pixelflut(rx:"+args.rx+" tx:"+args.tx+" mp:"+args.mp+" ps:"+args.ps+")")
  27. json_body = [{
  28. "measurement": "pixelflut",
  29. "fields": {
  30. "rx": float(args.rx),
  31. "tx": float(args.tx),
  32. "mp": float(args.mp),
  33. "ps": float(args.ps),
  34. }
  35. }]
  36. dbclient = InfluxDBClient(influx_host, influx_port, influx_user, influx_pass, influx_db)
  37. dbclient.write_points(json_body)
Add Comment
Please, Sign In to add comment