0

I'm using Grafana-csv-datasource that can be found at Github.

Basically it's a data source that works with csv.

I can add it to Grafana without errors, but when I try query something in a csv file, it gives the following error :

[2018-06-11 14:13:28,716] ERROR in app: Exception on /csv/query [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/flask_cors/decorator.py", line 128, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "/var/lib/grafana/plugins/grafana-csv-datasource/backend/PythonServer.py", line 237, in query_metrics
    if (query_results[target["target"]].dtype==object):
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2685, in __getitem__
    return self._getitem_column(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2692, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 2486, in _get_item_cache
    values = self._data.get(item)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 4115, in get
    loc = self.items.get_loc(item)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/indexes/base.py", line 3065, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: u'Time;measurementA;measurementB'
192.168.150.168 - - [11/Jun/2018 14:13:28] "POST /csv/query HTTP/1.1" 500 -
Gilles-Antoine Nys
  • 1,481
  • 16
  • 21
  • `u'Time;measurementA;measurementB'` suggest you're working with a CSV file that uses semicolons (`;`) instead of commas. I'd be surprised if Grafana isn't smart enough to identify this, but for the sake of fault-finding, try replacing the semicolons in the source file with commas, and see what the result is. – rst-2cv Jun 12 '18 at 10:00
  • Hi, changed to (`,`) but still not working. Thanks for help – Jota André Jun 12 '18 at 10:03
  • Would you show a bit of your code, in particular file loading and the query you're trying to achieve? – Joël Jun 12 '18 at 10:09
  • Hi, I'm uploading just a one line csv file to test: `17/01/2017,SAP86231,INDEX,340102`. It still not working, tried with `date,name,test,number 17/01/2017,SAP86231,INDEX,340102` and nothing. – Jota André Jun 12 '18 at 10:16

0 Answers0