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

fix error #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix error #10

wants to merge 1 commit into from

Conversation

insobi
Copy link

@insobi insobi commented Jul 29, 2021

the 'None' value returned from regex.match() wasn't handled as expected in those if condition, so errors happened. As a workaround, the type of return value from regex.match() could convert as a string.

@RavuAlHemio
Copy link
Owner

Greetings!

I'm not entirely sure that this is the correct solution. There should be some differentiation between the null value (None in Python, null in JSON and YAML) and a string containing such a word ("None" or "null") -- otherwise somebody could name an ACI object "null" and this would cause problems with this exporter -- and your fix would remove this distinction.

Can you provide a configuration snippet with which you are having trouble?

@insobi
Copy link
Author

insobi commented Jul 29, 2021

Hi,
I posted below error log which happened from previous commit. Please refer to it.

DEBUG:prometheus_aci_exporter:processing instance of class 'eqptIngrBytes5min' with DN 'topology/pod-1/node-104/sys/ch/supslot-1/sup/cpuport-1/CDeqptIngrBytes5min'
DEBUG:prometheus_aci_exporter:indexing: index -1, suffix ''
DEBUG:prometheus_aci_exporter:processing label definition {'property_name': 'dn', 'regex': '^topology/pod-(?P<pod>[1-9][0-9]*)/node-(?P<node>[1-9][0-9]*)/sys/(?P<interfaceType>[a-z]+)-\\[(?P<interface>[^\\]]+)\\]/'} for attributes {'childAction': '', 'cnt': '14', 'dn': 'topology/pod-1/node-104/sys/ch/supslot-1/sup/cpuport-1/CDeqptIngrBytes5min', 'floodAvg': '0', 'floodBase': '0', 'floodCum': '0', 'floodLast': '0', 'floodMax': '0', 'floodMin': '0', 'floodPer': '0', 'floodRate': '0.000000', 'floodSpct': '0', 'floodThr': '', 'floodTr': '0', 'floodTrBase': '0', 'lastCollOffset': '140', 'modTs': 'never', 'multicastAvg': '0', 'multicastBase': '0', 'multicastCum': '0', 'multicastLast': '0', 'multicastMax': '0', 'multicastMin': '0', 'multicastPer': '0', 'multicastRate': '0.000000', 'multicastRateAvg': '0.000000', 'multicastRateLast': '0.000000', 'multicastRateMax': '0.000000', 'multicastRateMin': '0.000000', 'multicastRateSpct': '0', 'multicastRateThr': '', 'multicastRateTr': '0.000000', 'multicastRateTrBase': '0.000000', 'multicastRateTtl': '0.000000', 'multicastSpct': '0', 'multicastThr': '', 'multicastTr': '0', 'multicastTrBase': '0', 'repIntvEnd': '2021-07-29T21:12:16.354+09:00', 'repIntvStart': '2021-07-29T21:09:56.351+09:00', 'status': '', 'unicastAvg': '0', 'unicastBase': '0', 'unicastCum': '0', 'unicastLast': '0', 'unicastMax': '0', 'unicastMin': '0', 'unicastPer': '0', 'unicastRate': '0.000000', 'unicastRateAvg': '0.000000', 'unicastRateLast': '0.000000', 'unicastRateMax': '0.000000', 'unicastRateMin': '0.000000', 'unicastRateSpct': '0', 'unicastRateThr': '', 'unicastRateTr': '0.000000', 'unicastRateTrBase': '0.000000', 'unicastRateTtl': '0.000000', 'unicastSpct': '0', 'unicastThr': '', 'unicastTr': '0', 'unicastTrBase': '0'}
DEBUG:prometheus_aci_exporter:updated labels are 'topology/pod-1/node-104/sys/ch/supslot-1/sup/cpuport-1/CDeqptIngrBytes5min'
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58520)
Traceback (most recent call last):
  File "prometheus_aci_exporter.py", line 354, in collect_fabric
    labels.update(updated_labels)
ValueError: dictionary update sequence element #0 has length 1; 2 is required

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.8/socketserver.py", line 747, in __init__
    self.handle()
  File "/usr/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "prometheus_aci_exporter.py", line 551, in do_GET
    generated_lines = [
  File "prometheus_aci_exporter.py", line 551, in <listcomp>
    generated_lines = [
  File "prometheus_aci_exporter.py", line 249, in collect
    yield from self.collect_fabric(fabric_name, fabric, controller, common_queries)
  File "prometheus_aci_exporter.py", line 356, in collect_fabric
    raise ValueError(f"failed to update labels in query {query_name!r} with {updated_labels!r}: {ex}")
ValueError: failed to update labels in query 'interface_rx_stats' with 'topology/pod-1/node-104/sys/ch/supslot-1/sup/cpuport-1/CDeqptIngrBytes5min': dictionary update sequence element #0 has length 1; 2 is required

@RavuAlHemio
Copy link
Owner

RavuAlHemio commented Jul 29, 2021

Ah yes, that's an issue with the configuration -- it expects a DN following the format

topology/pod-{POD}/node-{NODE}/sys/{PORTTYPE}-[{PORT}]/CDeqptIngrBytes5min

e.g.

topology/pod-1/node-101/sys/mgmt-[mgmt0]/CDeqptIngrBytes5min

or

topology/pod-1/node-101/sys/phys-[eth1/35]/CDeqptIngrBytes5min

but has instead obtained the DN

topology/pod-1/node-104/sys/ch/supslot-1/sup/cpuport-1/CDeqptIngrBytes5min

which doesn't follow this format, so it failed to extract the relevant values.

I'll look into integrating supslot/cpuport statistics into the sample configuration as well. Out of curiosity, what model is node 104 in your fabric? Is it a modular Nexus switch?

@insobi
Copy link
Author

insobi commented Jul 29, 2021

Node 104 is N9K-C9372PX. :) Anyway, like what you mentioned, retrieved dn format and expected dn format were not same. In this case, however, I supposed that it should be skipped without error if those are not same between retrieved and expected. Am I misunderstanding about the logic?

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

Successfully merging this pull request may close these issues.

2 participants