Overview
-
influxdb-python
: v.5.2.0 -
python
: version 3.4.3 - Machine: Window 10 + Windows subsystem for Linux (WSL)
Scenario
- Configured
udp
to be accessed via8089
- InfluxDB running via Powershell
- Python Script executed via WSL
Code
from influxdb import InfluxDBClient
def main():
client = InfluxDBClient(host='localhost',database='example',use_udp=True, udp_port=8089)
json_body = {
"tags": {
"host": "server01",
"region": "us-west"
},
"time": "2009-11-10T23:00:00Z",
"points": [{
"measurement": "cpu_load_short",
"fields": {
"value": 0.64
}
}]
}
try:
client.send_packet(json_body)
except Exception as e:
raise e
if __name__ == '__main__':
main()
Output
Instead of saving the information in the example
database the information is stored in a newly created database called udp
.
No measurements are created in example
All values are available in udp