Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse data and insert into InfluxDB #3

Open
Napsty opened this issue Dec 12, 2018 · 2 comments
Open

Unable to parse data and insert into InfluxDB #3

Napsty opened this issue Dec 12, 2018 · 2 comments
Assignees

Comments

@Napsty
Copy link

Napsty commented Dec 12, 2018

I slightly adjusted the mtr-monitor.sh to not create Docker containers because I have an existing InfluxDB in my environment. But the python script returns the following error:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
Traceback (most recent call last):
  File "./save_data.py", line 65, in <module>
    main()
  File "./save_data.py", line 61, in main
    HubEntry.commit()
  File "/usr/lib/python2.7/dist-packages/influxdb/helper.py", line 127, in commit
    rtn = client.write_points(cls._json_body_())
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 391, in write_points
    tags=tags)
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 436, in _write_points
    expected_response_code=204
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 278, in write
    headers=headers
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 248, in request
    raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {"error":"unable to parse '8.8.8.8,destination=8.8.8.8,hop=01-10.166.102.3 avg=3.56,best=0.38,last=6.53,loss=0.0,snt=30i,stdev=8.67,time=2018-12-12 11:16:06.119893,wrst=47.22': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=02-10.255.254.97 avg=0.79,best=0.45,last=0.86,loss=0.0,snt=30i,stdev=0.12,time=2018-12-12 11:16:06.119893,wrst=1.04': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=03-172.30.8.11 avg=0.59,best=0.39,last=0.67,loss=0.0,snt=30i,stdev=0.17,time=2018-12-12 11:16:06.119893,wrst=1.02': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=04-172.30.5.11 avg=0.79,best=0.54,last=0.77,loss=0.0,snt=30i,stdev=0.23,time=2018-12-12 11:16:06.119893,wrst=1.57': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=05-194.40.224.196 avg=1.53,best=1.29,last=1.65,loss=0.0,snt=30i,stdev=0.15,time=2018-12-12 11:16:06.119893,wrst=1.91': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=06-i79zhh-001-ten0-3-0-11.bb.ip-plus.net avg=2.12,best=1.8,last=2.12,loss=0.0,snt=30i,stdev=0.2,time=2018-12-12 11:16:06.119893,wrst=2.62': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=07-i79zhh-015-ae5.bb.ip-plus.net avg=4.62,best=1.7,last=1.92,loss=0.0,snt=30i,stdev=6.69,time=2018-12-12 11:16:06.119893,wrst=30.79': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=08-72.14.223.0 avg=3.03,best=2.69,last=3.03,loss=0.0,snt=30i,stdev=0.24,time=2018-12-12 11:16:06.119893,wrst=3.95': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=09-??? avg=0.0,best=0.0,last=0.0,loss=100.0,snt=30i,stdev=0.0,time=2018-12-12 11:16:06.119893,wrst=0.0': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=10-172.253.50.22 avg=3.99,best=3.7,last=4.5,loss=0.0,snt=30i,stdev=0.2,time=2018-12-12 11:16:06.119893,wrst=4.5': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=11-172.253.50.173 avg=4.34,best=3.43,last=3.7,loss=0.0,snt=30i,stdev=2.63,time=2018-12-12 11:16:06.119893,wrst=18.13': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=12-google-public-dns-a.google.com avg=2.12,best=1.95,last=1.95,loss=0.0,snt=30i,stdev=0.17,time=2018-12-12 11:16:06.119893,wrst=2.62': invalid number"}

I'm aware that I'm not using your script the way you wrote it, but maybe you have an idea if the problem is related to my InfluxDB (1.6.4) or to a different output of mtr (0.92)?

@carbolymer carbolymer self-assigned this Dec 23, 2018
@carbolymer
Copy link
Owner

carbolymer commented Dec 23, 2018

It looks like you're using python 2.7 by default on your system. I suppose that's because of some type conversion issues discrepancies between python 2 and 3. I've just pushed the changes (803296a) which explicitly use python 3. Can you check if the issue still occurs?

If yes, please provide version of python and influxdb python package.

@mmihir82
Copy link

mmihir82 commented Oct 16, 2020

Hello @carbolymer, @Napsty, I have also InfluxDB, Grafana docker running, what configuration you made to have it working? I am using python3 and mtr-monitor is running.

● mtr-monitor.service - MTR Monitor
   Loaded: loaded (/lib/systemd/system/mtr-monitor.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-10-16 00:30:49 PDT; 14min ago
 Main PID: 25797 (mtr-monitor.sh)
    Tasks: 12 (limit: 11059)
   CGroup: /system.slice/mtr-monitor.service
           ├─25797 /bin/bash /opt/mtr-monitor/mtr-monitor.sh
           ├─34941 /bin/bash /opt/mtr-monitor/mtr-monitor.sh
           ├─34942 /bin/bash /opt/mtr-monitor/mtr-monitor.sh
           ├─34943 mtr --report --json --report-cycles 30 ai.io
           ├─34944 sleep 40
           ├─34945 python3 /opt/mtr-monitor/save_data.py --host localhost --port 8086
           ├─34946 mtr --report --json --report-cycles 30 docker.io
           ├─34947 python3 /opt/mtr-monitor/save_data.py --host localhost --port 8086
           ├─34948 mtr-packet
           ├─34950 mtr-packet
           ├─34951 mtr --report --json --report-cycles 30 quay.io
           └─34952 mtr --report --json --report-cycles 30 nvcr.io

Oct 16 00:30:49 node01-net-dev systemd[1]: Started MTR Monitor.

But i don't anything in the dashboard? What changes I need to make:

CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                 PORTS                                                  NAMES
1428156f7d36        grafana/grafana:7.2.0       "/run.sh"                32 hours ago        Up 10 hours            127.0.0.1:3000->3000/tcp                           grafana
edfb8b7e03f8        telegraf:1.15.3-alpine      "/entrypoint.sh tele…"   36 hours ago        Up 10 hours            8092/udp, 8094/tcp, 127.0.0.1:8125->8125/udp           telegraf
87fdace453ff        influxdb:1.8-alpine         "/entrypoint.sh infl…"   36 hours ago        Up 10 hours            127.0.0.1:8086->8086/tcp                               influxdb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@carbolymer @Napsty @mmihir82 and others