netscaler / netscaler-adc-metrics-exporter

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

exporter crashes on NoneType data_items #7

Closed epleterte closed 5 years ago

epleterte commented 5 years ago

When looping through data_items from entity_stats it appears some items are NoneType in my environment. This causes the exporter to crash and die.

I get this error in the logs:

2019-06-25T10:24:39+0000 ERROR    Exiting: invalid arguments! could not register collector for ['10.0.0.1']::'NoneType' object has no attribute 'keys'

After some debugging, I can see that entity_stats is a list of dicts, but some entries are coming back as NoneType . After some of these NoneType entries, I see dicts again, and later more NoneType entries.

aroraharsh23 commented 5 years ago

@epleterte For this issue, can you share the complete exporter logs, it will be helpful to reproduce the crash, sys.exit() has already been added for such case, but logs will give more clarity.

aroraharsh23 commented 5 years ago

@epleterte Forgot to mention, please also include the environment and which mode you are running exporter in(container, k8s or script).

epleterte commented 5 years ago

Hey, sure! I am running this as a script directly on the host. Here's a full log:


2019-07-01T11:12:28+0000 INFO     Starting the exporter on port 9268.
2019-07-01T11:12:28+0000 INFO     Registering collector for ['10.0.0.1']
2019-07-01T11:12:28+0000 INFO     Collecting metric protocoltcp for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric service for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric csvserver for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric Interface for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric system for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric protocolhttp for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric ssl for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric services for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric ns for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric lbvserver for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric protocolip for 10.0.0.1
2019-07-01T11:12:28+0000 INFO     Collecting metric nscapacity for 10.0.0.1
2019-07-01T11:12:29+0000 INFO     metrices for lbvserver with k8sprefix "azurelbdnsvserver" are not fetched
2019-07-01T11:12:29+0000 ERROR    Exiting: invalid arguments! could not register collector for ['10.0.0.1']::'NoneType' object has no attribute 'keys'```
pasarn commented 5 years ago

Hey,

i have the same error in my envirement.

2019-07-01T15:50:20+0200 INFO Starting the exporter on port 8888. 2019-07-01T15:50:20+0200 INFO Registering collector for ['10.10.10.1:80'] 2019-07-01T15:50:20+0200 INFO Collecting metric protocolip for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric ssl for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric services for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric protocoltcp for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric protocolhttp for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric system for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric service for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric csvserver for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric lbvserver for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric nscapacity for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric ns for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO Collecting metric Interface for 10.10.10.1:80 2019-07-01T15:50:21+0200 INFO metrices for lbvserver with k8sprefix "vs" are not fetched 2019-07-01T15:50:21+0200 ERROR Exiting: invalid arguments! could not register collector for ['10.10.10.1:80']::'NoneType' object has no attribute 'keys' 2019-07-01T15:50:22+0200 INFO Sleeping for 10 seconds.

aroraharsh23 commented 5 years ago

Thanks for your input, i have updated the file as suggested by @epleterte, will update the quoy version as well.

epleterte commented 5 years ago

@haroraCitrix Great! Thanks! :)