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

Cannot export stats to InfluxDB #750

Closed
ruudboon opened this issue Dec 10, 2015 · 33 comments
Closed

Cannot export stats to InfluxDB #750

ruudboon opened this issue Dec 10, 2015 · 33 comments

Comments

@ruudboon
Copy link

I'm running glances like
glances --export-influxdb -t 60 -d -q

When exporting to InfluxDB i'm seeing multiple errors in the log file

Cannot export myserver.ip stats to InfluxDB (400: unable to parse 'myserver.ip ': invalid field format
Cannot export myserver.network stats to InfluxDB (400: write failed: field type conflict: input field "tun0.time_since_update" on measurement "myserver.network" is type float64, already exists as type integer
Cannot export myserver.sensors stats to InfluxDB (400: unable to parse 'myserver.sensors ': invalid field format
)
Cannot export myserver.docker stats to InfluxDB (400: unable to parse 'myserver.docker ': invalid field format

I'm running InfluxDB v0.9.3.

@nicolargo nicolargo added the bug label Dec 11, 2015
@nicolargo nicolargo added this to the Version 2.6 milestone Dec 11, 2015
@nicolargo
Copy link
Owner

Issue confirmed.

With InfluxDB 0.9.3.

@asergi Glances can not export because there are some 'i' char in the export data. Is it due to the compat.py script ?

2015-12-11 15:10:13,564 -- ERROR -- Cannot export localhost.load stats to InfluxDB (400: unable to parse 'localhost.load cpucore=4i,load_careful=0.7,load_critical=5.0,load_warning=1.0,min1=0.07,min15=0.13,min5=0.12': invalid number
)
2015-12-11 15:10:13,566 -- ERROR -- Cannot export localhost.ip stats to InfluxDB (400: unable to parse 'localhost.ip address="192.168.176.128",gateway="192.168.176.1",mask="255.255.255.0",mask_cidr=24i': invalid number
)
2015-12-11 15:10:13,569 -- ERROR -- Cannot export localhost.memswap stats to InfluxDB (400: unable to parse 'localhost.memswap free=16701263872i,memswap_careful=50.0,memswap_critical=90.0,memswap_warning=70.0,percent=0.5,sin=295927808i,sout=700071936i,total=16777211904i,used=75948032i': invalid number

@ruudboon
Copy link
Author

Could this magic 'i' be related to influxdata/influxdb#3519
And the conflict error with this one: influxdata/influxdb#3032 ?

@nicolargo
Copy link
Owner

+1 for @ruudboon

@nicolargo
Copy link
Owner

The first bug (the 'i' one) is corrected by upgrading InfluxDB to 0.9.4 or higher.

The other one (float), should be corrected in the scope of this issue (have a look on influxdata/influxdb#3032).

@ruudboon
Copy link
Author

Upgrading to 0.9.4 is keeping the same issues for me. How can I see the extended info you are seeing @nicolargo ?

@nicolargo
Copy link
Owner

@ruudboon what extended info ? it's only the Glances log file...

@ruudboon
Copy link
Author

I'm missing the data in the log. Only seeing
Cannot export myserver.sensors stats to InfluxDB (400: unable to parse 'myserver.sensors ': invalid field format)

@nicolargo
Copy link
Owner

Can you try with the latest DEVELOP branch version or disable the Sensor plugin (--disable-sensors)

@nicolargo
Copy link
Owner

The latest commit of the develop branch should solve this issue and the issue #749 .

Please:

  • download the develop branch
  • upgrade InfluxDB to 0.9.5 or higher
  • upgrade the InfluxDB Python lib
  • drop your existing database (sorry for that but InfluxDB is under development)
  • run Glances and it should works like a charm

@ruudboon
Copy link
Author

Cool will try to compile Glances myself. Running the Freebsd port now.

@nicolargo
Copy link
Owner

No need to compile, you are in a Python world...

@ruudboon
Copy link
Author

Owh cool. Didn't realize it was written in Python.

@Jestre
Copy link

Jestre commented Jan 1, 2016

I'm getting similar errors, and after reading this I went ahead and pulled the develop branch and installed it in a venv. Since I found this project (and InfluxDB) this morning, I am running glances-dev, influx 0.9.6 (from their influxdb-0.9.6.1-1.x86_64.rpm), and fresh pip installs of the requisite Python modules.

I get the same types of errors as OP:
"unable to parse 'localhost.ip' : invalid field format
and the float64 vs integer errors on localhost.network and localhost.diskio

Logs available as needed.

For the record, system is Fedora 23.

Thanks.

@unlikelyzero
Copy link

I'm seeing that same issue as Jestre with Ubuntu 14.04

@nicolargo
Copy link
Owner

I confirm that it is working like a charm with the following configuration:

  • Glances DEVELOP branch
  • InfluxDB 0.9.6
  • Python lib InfluxDB 2.10.0

"unable to parse 'localhost.ip' : invalid field format
=> this is a warning message.

and the float64 vs integer errors on localhost.network and localhost.diskio
=> Please delete and re-create your InfluxDB database.

@Jestre
Copy link

Jestre commented Jan 4, 2016

So @nicolargo what OS are you on? I find it hard to believe that this is purely an issue on Ubuntu and Fedora. I have the same versions of things as you list, and I had deleted and recreated my DB without success. Is there some command other than 'drop database' to get rid of the old one with InfluxDB?

@nicolargo
Copy link
Owner

Tested on both Ubuntu 14.04 LTS and CentOS 7.0

@Jestre
Copy link

Jestre commented Jan 4, 2016

@nicolargo Thank you. I will try back in a few months to see if the issues have been resolved. Appreciate the input.

@unlikelyzero
Copy link

@nicolargo how do I ensure that I'm running on the development branch? I run the following command:
root@test:~# cd /tmp/glances-develop
root@test:
/tmp/glances-develop# LANGUAGE=en_US.utf8 /usr/bin/python -m glances -d -C ~/tmp/glances-develop/conf/glances.conf

@kalashnikov
Copy link

Hi, I think I got similar issue.

Just try to re-install glances using pip install --upgrade glances

2016-01-06 02:03:08,728 -- DEBUG -- Export docker stats to InfluxDB
2016-01-06 02:03:08,730 -- DEBUG -- Setting read timeout to None
2016-01-06 02:03:08,730 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 400 83
2016-01-06 02:03:08,732 -- ERROR -- Cannot export docker stats to InfluxDB (400: {"error":"unable to parse 'docker ': invalid field format"}
)
2016-01-06 02:03:08,732 -- DEBUG -- Export network stats to InfluxDB
2016-01-06 02:03:08,741 -- DEBUG -- Setting read timeout to None
2016-01-06 02:03:08,741 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 400 149
2016-01-06 02:03:08,742 -- ERROR -- Cannot export network stats to InfluxDB (400: {"error":"write failed: field type conflict: input field \"ip6gre0.time_since_update\" on measurement \"network\" is type float64, already exists as type integer"}
)

The measurement is created but it's empty.

Environment:
Ubuntu 14.04
InfluxDB 0.9.6.1
Glances-2.5.1
psutil 3.0.0


After installing from repository,

2016-01-06 02:16:19,362 -- ERROR -- Cannot export sensors stats to InfluxDB (400: {"error":"unable to parse 'sensors ': invalid field format"}
)
2016-01-06 02:16:19,362 -- DEBUG -- Export docker stats to InfluxDB
2016-01-06 02:16:19,364 -- DEBUG -- Setting read timeout to None
2016-01-06 02:16:19,365 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 400 83
2016-01-06 02:16:19,366 -- ERROR -- Cannot export docker stats to InfluxDB (400: {"error":"unable to parse 'docker ': invalid field format"}
)
2016-01-06 02:16:19,367 -- DEBUG -- Export network stats to InfluxDB
2016-01-06 02:16:19,372 -- DEBUG -- Setting read timeout to None
2016-01-06 02:16:19,373 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 204 0
2016-01-06 02:16:19,374 -- DEBUG -- Export processcount stats to InfluxDB
2016-01-06 02:16:19,376 -- DEBUG -- Setting read timeout to None
2016-01-06 02:16:19,377 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 204 0
2016-01-06 02:16:19,378 -- DEBUG -- Export cpu stats to InfluxDB
2016-01-06 02:16:19,380 -- DEBUG -- Setting read timeout to None
2016-01-06 02:16:19,381 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 204 0
2016-01-06 02:16:19,498 -- DEBUG -- Plugin batpercent update return []
2016-01-06 02:16:19,499 -- DEBUG -- Plugin cpu update return {'softirq': 0.0, 'iowait': 0.0, 'system': 1.8, 'guest': 0.0, 'idle': 95.3, 'user': 2.5, 'guest_nice': 0.0, 'irq': 0.0, 'total': 4.5, 'steal': 0.1, 'nice': 0.2}
2016-01-06 02:16:24,517 -- DEBUG -- Export stats using the influxdb module
2016-01-06 02:16:24,518 -- DEBUG -- Docker export error 'containers'
2016-01-06 02:16:24,518 -- DEBUG -- Plugin load update return {'cpucore': 2, 'min1': 0.32, 'min5': 0.23, 'min15': 0.14}
2016-01-06 02:16:24,519 -- DEBUG -- Export load stats to InfluxDB
2016-01-06 02:16:24,519 -- DEBUG -- Plugin ip update return {}
2016-01-06 02:16:24,521 -- DEBUG -- Plugin memswap update return {'used': 242094080L, 'percent': 90.2, 'free': 26337280L, 'sout': 311840768, 'total': 268431360L, 'sin': 38715392}
2016-01-06 02:16:24,521 -- DEBUG -- Setting read timeout to None
2016-01-06 02:16:24,522 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 204 0
2016-01-06 02:16:24,523 -- DEBUG -- Export ip stats to InfluxDB
2016-01-06 02:16:24,533 -- DEBUG -- Setting read timeout to None
2016-01-06 02:16:24,535 -- DEBUG -- "POST /write?db=glances HTTP/1.1" 400 79
2016-01-06 02:16:24,537 -- ERROR -- Cannot export ip stats to InfluxDB (400: {"error":"unable to parse 'ip ': invalid field format"}
)

Looks better but still have errors and empty in measurement.

@nicolargo
Copy link
Owner

The InfluxDB interface is breaked between Glances 2.5.1 and InfluxDB 0.9.2 or higher.

Please use the lastest Glances Development branch AND the latest InfluxDB AND the latest Python InfluxDB lib.

Tested OK with:

  • Glances DEVELOP branch (commit dcbb96f)
  • InfluxDB 0.9.6.1
  • Python InfluxDB lib 2.11.0 (from Pypi)
  • Grafana 2.6.0

@Josue-T
Copy link

Josue-T commented Feb 14, 2016

Hello,

When I try to lunch glances as client I have an error :

# glances --export-influxdb -c 127.0.0.1
Traceback (most recent call last):
  File "/opt/yunohost/glances/bin/glances", line 9, in <module>
    load_entry_point('Glances==2.5.1', 'console_scripts', 'glances')()
  File "/opt/yunohost/glances/lib/python3.4/site-packages/Glances-2.5.1-py3.4.egg/glances/__init__.py", line 150, in main
    if not client.login():
  File "/opt/yunohost/glances/lib/python3.4/site-packages/Glances-2.5.1-py3.4.egg/glances/client.py", line 127, in login
    self.stats = GlancesStatsClient(config=self.config, args=self.args)
  File "/opt/yunohost/glances/lib/python3.4/site-packages/Glances-2.5.1-py3.4.egg/glances/stats.py", line 304, in __init__
    self.load_plugins_and_exports(self.args)
  File "/opt/yunohost/glances/lib/python3.4/site-packages/Glances-2.5.1-py3.4.egg/glances/stats.py", line 91, in load_plugins_and_exports
    self.load_exports(args=args)
  File "/opt/yunohost/glances/lib/python3.4/site-packages/Glances-2.5.1-py3.4.egg/glances/stats.py", line 134, in load_exports
    export_module = __import__(os.path.basename(item)[:-3])
ImportError: No module named 'glances_influxdb'

Thank

@gabrieljames
Copy link

Ubuntu 14.0 Influx 0.10

apt-get installation

$ glances --help
Glances version 1.7.3 with PsUtil 1.2.1

$ glances --export-influxdb -t 60 -d -q
option --export-influxdb not recognized

Will this work?

@nicolargo
Copy link
Owner

Nope. You need Glances 2.5.1 or higher...

@gabrieljames
Copy link

Where from? Don't know why this is not the latest?

On Wednesday, 2 March 2016, Nicolas Hennion [email protected]
wrote:

Nope. ou need Glances 2.5.1 or higher...

@nicolargo
Copy link
Owner

@gabrieljames
Copy link

Thanks will pull from git repo.

Ubuntu package repository apt-get installs an old version of Glances

@gabrieljames
Copy link

Ubuntu 14.04

sudo apt-get install git
sudo apt-get install python-pip
sudo apt-get install python-dev
git clone -b develop https://github.com/nicolargo/glances.git

sudo pip install --upgrade glances
Requirement already up-to-date: glances in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: psutil>=2.0.0 in /usr/local/lib/python2.7/dist-packages (from glances)
Cleaning up...

glances --help
Glances version 1.7.3 with PsUtil 1.2.1

Documentation unclear, procedure followed as above, software reported upgrade complete, no errors reported, however, software still reporting original version.

Switching to user forum for user support to solve problem (wtf)

@nicolargo
Copy link
Owner

@gabrieljames Please switch to the Glances user forum. Your problem is not a development issue...

=> https://groups.google.com/forum/?hl=en#!forum/glances-users

@gabrieljames
Copy link

Okay, thanks for your help.

@gabrieljames
Copy link

Alright, not getting any responses in the user forum.

As mentioned in feature suggestion, #794

We are testing several other data collectors (collectd, telegraf, logstash, topbeat) so we can come up with a comprehensive metrics solution for our development and production needs.

I was optimistic to see the feature suggestion for logging of all processes and associated metrics. It would be good to test glances as a service with Influx and Elasticsearch to see if it adds value to the stacks.

My main concern at the moment is getting timely support to solve relatively simple issues like software installation, configuration and updates.

I have to say the other vendors and developers in this space have been very responsive to help address these sorts of issues as they arise. They have not drawn subtle distinctions between developer and user support channels, and have been more concerned with helping their users get up and running.

The update installation upgrade procedure has not been successful. I am reluctant to waste time on this if the support is going to be painful as we can do without the headache and will leave it.

Anyway, we are genuinely in interested in using your software,

Please let me know if you are willing to help us so we can make a call on it.

@nicolargo
Copy link
Owner

@gabrieljames i just post a respond on the forum.

I ask you to switch to the forum because the Github issue tracker is dedicated to enhancement request and bug report. Glances is installed more or less 14.000 times per week, i do not think that the installation process is "bugged".

You are welcome to contribute to the documentation if you think that it should be enhance.

@hflamboauto1
Copy link

hflamboauto1 commented Jun 18, 2017

Having same problem here

glances --version
Glances v2.10 with psutil v5.2.2

Errors on logs

2017-06-18 11:11:36,532 -- ERROR -- Cannot export localhost.docker stats to InfluxDB (400: {"error":"unable to parse 'localhost.docker ': invalid field format"}
)
2017-06-18 11:11:39,580 -- ERROR -- Cannot export localhost.sensors stats to InfluxDB (400: {"error":"unable to parse 'localhost.sensors ': invalid field format"}
)
2017-06-18 11:11:39,638 -- ERROR -- Cannot export localhost.docker stats to InfluxDB (400: {"error":"unable to parse 'localhost.docker ': invalid field format"}
)
2017-06-18 11:11:42,791 -- ERROR -- Cannot export localhost.sensors stats to InfluxDB (400: {"error":"unable to parse 'localhost.sensors ': invalid field format"}
)
2017-06-18 11:11:42,795 -- ERROR -- Cannot export localhost.docker stats to InfluxDB (400: {"error":"unable to parse 'localhost.docker ': invalid field format"}
)

Errors show up even with

LOG_CFG=/usr/local/etc/glances/glances.json glances --export-influxdb -C /usr/local/etc/glances/glances.conf --disable-sensor

On influx side i can see:

influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:19 +0000] "POST /write?db=glances HTTP/1.1" 400 91 "-" "python-requests/2.18.1" 829292b6-5406-11e7-a2f2-000000000000 234
influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:19 +0000] "POST /write?db=glances HTTP/1.1" 400 91 "-" "python-requests/2.18.1" 829399ed-5406-11e7-a2f5-000000000000 234
i

all other are 204

influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:19 +0000] "POST /write?db=glances HTTP/1.1" 204 0 "-" "python-requests/2.18.1" 82a00e82-5406-11e7-a2f7-000000000000 22144
influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:19 +0000] "POST /write?db=glances HTTP/1.1" 204 0 "-" "python-requests/2.18.1" 82a01515-5406-11e7-a2f8-000000000000 43220
influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:20 +0000] "POST /write?db=glances HTTP/1.1" 204 0 "-" "python-requests/2.18.1" 82f234da-5406-11e7-a2f9-000000000000 23429
influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:20 +0000] "POST /write?db=glances HTTP/1.1" 204 0 "-" "python-requests/2.18.1" 83316fc6-5406-11e7-a2fa-000000000000 23883
influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:21 +0000] "POST /write?db=glances HTTP/1.1" 204 0 "-" "python-requests/2.18.1" 8391b3a0-5406-11e7-a2fb-000000000000 23478
influxdb    | [httpd] 172.17.0.1 - root [18/Jun/2017:09:14:21 +0000] "POST /write?db=glances HTTP/1.1" 204 0 "-" "python-requests/2.18.1" 8391bd1d-5406-11e7-a2fc-000000000000 44711
in

this makes me believe that there's a problem with the format written to influxdb for those metrics.

I will investigate on my own but would like to keep track on this and ask for any advice.

Thanks for this nice tool. Cheers

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

No branches or pull requests

8 participants