How to monitor the status of a switch port via API

Namgyu
Getting noticed

How to monitor the status of a switch port via API

Hi,

 

I wonder how to monitor the status, especially connectivity of a switch port.

When I put the cursor on the connectivity bar whose color is red, it shows a message saying "Feb 26 xx:xx – Feb 27 xx:xx, 1 Gigabit link failed, speed downshifted".

 

캡처.PNG

 

What is the standard of changing color and how can I get the information of the status of the switch port via API?

 

p.s. I know how to get configuration of a switch port via the API(GET /devices/{serial}/switchPorts).

 

 

8 Replies 8
BrechtSchamp
Kind of a big deal
Namgyu
Getting noticed

@BrechtSchamp Thank you at all times. 👍

ptouch
Just browsing

I'm using the same API but I get conflicting Traffic reporting between UI and API.

On the UI I have 

ptouch_0-1733222094878.png

 

while on the JSON output I get:

        "usageInKb": {
            "total"1051718192,
            "sent"329072260,
            "recv"722645932
        },
        "clientCount"1,
        "powerUsageInWh"0.0,
        "trafficInKbps": {
            "total"99718.4,
            "sent"31200.9,
            "recv"68517.5
        }
    },
 
also I don't know the timespan to use as I want to get updates every 5 or so seconds like the UI

Any idea on what's the most recent timespan to use and why those values are different between UI and API (even it is in Mbps vs Kbps)
 
BTW the API call used is:
https://api.meraki.com/api/v1/devices/{serialnumberofswitch}/switch/ports/statuses?timespan=86400
(I don't know the minimum timespan possible)
Oren
Meraki Employee
Meraki Employee

This might be a matter of conversion.
1Mb = 1,024 Kb (not 1,000).
1Gb = 1,024 Mb = 1,048,576 Kb.

Therefore 1,051,718,192 Kb = 1,003 Gb.
Does it make sense?

Prodrick
Building a reputation

Unless you have a very small environment, I wouldn’t recommend a timespan lower than 300 seconds as this is a device-level API call and you can get rate limited if you’re not careful.  I make these every 900 seconds and use SNMP if I have more than 1000 switches or need more frequent updates.

MartinS
Building a reputation

There are some nice Org wide calls for this now (some in beta), so scaling to thousands of switches on a 5 min polling interval via the dashboard API is totally possible (we do this!)

---
COO
Highlight - Service Observability Platform
www.highlight.net
Prodrick
Building a reputation

Agreed. We’re very much looking forward to using the two new org-level switch endpoints when they graduate from early access to general availability. They are orders of magnitude more scalable than the current statuses endpoint, so they will provide more flexibility. However, I still have customers with thousands of switches who using my observability platform and run automation scripts for IMACD IT Operations, so we still need to exercise extreme caution to  avoid introducing or being affected by rate limiting and to have options when the API is already clogged by some other tool.

MartinS
Building a reputation

Yes, really we need a way to carve out API resources so we don't impact, or are impacted by other API apps. @Oren please please please!

---
COO
Highlight - Service Observability Platform
www.highlight.net
Get notified when there are additional replies to this discussion.