Open zhiltsov-dtln opened 3 years ago
cat /etc/system-release CentOS release 6.10 (Final) ~/alerts-report:$influx -version InfluxDB shell version: 1.7.9 ~/alerts-report:$python3 --version Python 3.4.10 ~/alerts-report:$pip3 list | grep influx influxdb 5.3.1
influx_df_test.py:
#!/usr/bin/env python3 import alerts_report_config as cfg from datetime import datetime import pandas as pd from influxdb import DataFrameClient df = pd.DataFrame([['ttt', 'Error "Hold Expired"']], index=[datetime.utcnow()], columns=['disappear_reason', 'plugin_output']) print(df) influx_write_df_client = DataFrameClient(cfg.influx_host, cfg.influx_port, cfg.influx_user, cfg.influx_pwd, cfg.influx_db) influx_write_df_client.write_points(df, 'test', protocol='line')
./influx_df_test.py disappear_reason plugin_output 2021-05-13 08:05:22.286514 ttt Error "Hold Expired" Traceback (most recent call last): File "./influx_df_test.py", line 17, in <module> influx_write_df_client.write_points(df, 'test', protocol='line') File "/usr/lib/python3.4/site-packages/influxdb/_dataframe_client.py", line 140, in write_points protocol=protocol) File "/usr/lib/python3.4/site-packages/influxdb/client.py", line 608, in write_points consistency=consistency) File "/usr/lib/python3.4/site-packages/influxdb/client.py", line 685, in _write_points protocol=protocol File "/usr/lib/python3.4/site-packages/influxdb/client.py", line 419, in write headers=headers File "/usr/lib/python3.4/site-packages/influxdb/client.py", line 378, in request raise InfluxDBClientError(err_msg, response.status_code) influxdb.exceptions.InfluxDBClientError: 400: {"error":"unable to parse 'test disappear_reason=\"ttt\",plugin_output=\"Error \"Hold Expired\"\" 1620893122286513920': bad timestamp"}
influx_df_test.py: