netscaler / netscaler-adc-metrics-exporter

Export metrics from Citrix ADC (NetScaler) to Prometheus
89 stars 33 forks source link

'NoneType' object has no attribute '__getitem__' #5

Closed alexdepalex closed 5 years ago

alexdepalex commented 5 years ago

When the exporter is collecting data, some metrics fail with 'NoneType' object has no attribute '__getitem__'

The exporter is running in a docker container, latest version from master (1.0.5), with the following flags:

    - --target-nsip=<target host>
    - --port=9400
    - --username=<user>
    - --password=<password>
    - --secure=yes

The exporter was tested by retrieving the /metrics url.

alexdepalex commented 5 years ago

Here's the full logging.

netscaler-out.txt

aroraharsh23 commented 5 years ago

@alexdepalex new version has been updated in quoy. you may try the above issue on that.

alexdepalex commented 5 years ago

It seems like it's a lot less common now. I don't see any caught exceptions, but I still do see the occasional TypeError traceback. Running latest from quay.io.

container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric system for netscaler_host
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric system for netscaler_host
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric protocolhttp for netscaler_host
container1    | ----------------------------------------
container1    | Traceback (most recent call last):
container1    |   File "/usr/lib/python2.7/SocketServer.py", line 596, in process_request_thread
container1    |     self.finish_request(request, client_address)
container1    |   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
container1    |     self.RequestHandlerClass(request, client_address, self)
container1    |   File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
container1    |     self.handle()
container1    |   File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
container1    |     self.handle_one_request()
container1    |   File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
container1    |     method()
container1    |   File "/usr/lib/python2.7/site-packages/prometheus_client/exposition.py", line 146, in do_GET
container1    |     output = encoder(registry)
container1    |   File "/usr/lib/python2.7/site-packages/prometheus_client/openmetrics/exposition.py", line 14, in generate_latest
container1    |     for metric in registry.collect():
container1    |   File "/usr/lib/python2.7/site-packages/prometheus_client/registry.py", line 75, in collect
container1    |     for metric in collector.collect():
container1    |   File "/exporter/exporter.py", line 89, in collect
container1    |     label_values = [data_item[key] for key in [v[0] for v in entity['labels']]]
container1    | TypeError: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric protocolhttp for netscaler_host
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric ssl for netscaler_host
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric ssl for netscaler_host
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric services for netscaler_host
container1    | 2019-06-05T05:58:09+0000 INFO     Collecting metric services for netscaler_host
container1    | 2019-06-05T05:58:09+0000 WARNING  Could not collect metric: 'servicegroup'
alexdepalex commented 5 years ago

Nevermind. They're still there unfortunately.

container1    | 2019-06-05T06:22:19+0000 WARNING  Could not collect metric: 'servicegroup'
container1    | 2019-06-05T06:22:19+0000 INFO     Collecting metric lbvserver for netscaler_host
container1    | 2019-06-05T06:22:19+0000 INFO     Collecting metric ssl for netscaler_host
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotrequests to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotresponses to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotposts to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotgets to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotothers to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter spdytotstreams to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter spdyv2totstreams to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter spdyv3totstreams to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotrxrequestbytes to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotrxresponsebytes to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptot10requests to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptot11requests to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding counter httptotchunkedrequests to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httprequestsrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge spdystreamsrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httpresponsesrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httppostsrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httpgetsrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httpothersrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httpchunkedresponsesrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge httpchunkedrequestsrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge http10responsesrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 ERROR    Caught exception while adding gauge http11responsesrate to protocolhttp: 'NoneType' object has no attribute '__getitem__'
container1    | 2019-06-05T06:22:19+0000 INFO     Collecting metric protocolip for netscaler_host
container1    | 2019-06-05T06:22:19+0000 INFO     Collecting metric services for netscaler_host
subashd commented 5 years ago

@alexdepalex... we have released version v1.0.5, could you please pull image using quay.io/citrix/netscaler-metrics-exporter:v1.0.5 ? Could you please try with this image and let us know if you face any issue?

alexdepalex commented 5 years ago

I apparently used the latest tag instead of v1.0.5. Using that version, logging looks way better. Haven't seen any exceptions.