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

TypeError: can only concatenate str (not "NoneType") to str #5

Closed
Mdleal opened this issue Jun 21, 2024 · 4 comments
Closed

TypeError: can only concatenate str (not "NoneType") to str #5

Mdleal opened this issue Jun 21, 2024 · 4 comments

Comments

@Mdleal
Copy link

Mdleal commented Jun 21, 2024

Traceback (most recent call last): File "/usr/local/lib/python3.12/socketserver.py", line 692, in process_request_thread self.finish_request(request, client_address) File "/usr/local/lib/python3.12/socketserver.py", line 362, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/lib/python3.12/socketserver.py", line 761, in __init__ self.handle() File "/usr/local/lib/python3.12/http/server.py", line 436, in handle self.handle_one_request() File "/usr/local/lib/python3.12/http/server.py", line 424, in handle_one_request � method() File "/app/meraki-api-exporter.py", line 245, in do_GET target = '{serial="' + host + \ ~~~~~~~~~~~~^~~~~~ TypeError: can only concatenate str (not "NoneType") to str

@TheHolm
Copy link
Owner

TheHolm commented Sep 10, 2024

Any more details? it seems your network have some devices without Serial Number, which is strange.

@Corruptsector
Copy link
Contributor

Hey, We are seeing this as well. It looks like in our case cellular gateways return no serial.

----------------------------------------                                                     
Exception occurred during processing of request from ('10.42.4.159', 55506)                  
Traceback (most recent call last):                                                           
  File "/usr/local/lib/python3.11/socketserver.py", line 691, in process_request_thread      
    self.finish_request(request, client_address)                                             
  File "/usr/local/lib/python3.11/socketserver.py", line 361, in finish_request              
    self.RequestHandlerClass(request, client_address, self)                                  
  File "/usr/local/lib/python3.11/socketserver.py", line 755, in __init__                    
    self.handle()                                                                            
  File "/usr/local/lib/python3.11/http/server.py", line 436, in handle                       
    self.handle_one_request()                                                                
  File "/usr/local/lib/python3.11/http/server.py", line 424, in handle_one_request           
    method()                                                                                 
  File "/app/meraki-api-exporter.py", line 195, in do_GET                                    
    target = '{serial="' + host + \                                                          
             ~~~~~~~~~~~~^~~~~~                                                              
TypeError: can only concatenate str (not "NoneType") to str                                  
----------------------------------------                                                     

output from dashboard.organizations.getOrganizationDevicesUplinksLossAndLatency

    {
        'networkId': None,
        'serial': None,
        'uplink': 'cellular',
        'ip': '8.8.8.8',
        'timeSeries': [
            {
                'ts': '2025-03-13T21:52:59Z',
                'lossPercent': 0.0,
                'latencyMs': 70.2
            },
            {
                'ts': '2025-03-13T21:53:59Z',
                'lossPercent': 0.0,
                'latencyMs': 60.7
            }
        ]
    }

You can add the below to skip the the loss and latency for the one with no serial

for host in host_stats.keys():
    if host != None:

@TheHolm
Copy link
Owner

TheHolm commented Mar 14, 2025

Could you please submit pull request with the patch?

Corruptsector added a commit to Corruptsector/meraki-dashboard-promethus-exporter that referenced this issue Mar 16, 2025
Adding in a check if host != None
TheHolm added a commit that referenced this issue Mar 18, 2025
Fix issue #5 to handle hosts without serial number.
@TheHolm
Copy link
Owner

TheHolm commented Mar 18, 2025

Thank you. Merged. Issue closed.

@TheHolm TheHolm closed this as completed Mar 18, 2025
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

No branches or pull requests

3 participants