Get Device Status of Switch

Solved
Tod
Here to help

Get Device Status of Switch

I am looking for a way to get the device status of a MS switch using python and the API.

I have attempted:

getDevice

getOrginizationDevicesStatuses

get DeviceStatuses

 

This works great for a MR device but the MS device seems to not populate those fields.

The dashboard does have this in the form of a status for each switch in the form of a green check mark that reports "good"

I have been unable to identify a way to pull this information from the API.  Any ideas?

Screenshot 2024-06-12 at 3.21.27 PM.png

1 Accepted Solution
Tod
Here to help

Thank you for the pointer.  Found the issue.  The correct line of code is as follows:

status = dashboard.organizations.getOrganizationDevicesStatuses(org_id,serials = device['serial'])

View solution in original post

3 Replies 3
RaphaelL
Kind of a big deal
Kind of a big deal

Hi ,

 

It does work fine for MS. Have you tried with a specific serial ?

status = dashboard.devices.getOrganizationDevicesStatuses(org_id, device['serial'])
AttributeError: 'Devices' object has no attribute
 
status = dashboard.devices.getDevicesStatuses(org_id, device['serial'])
AttributeError: 'Devices' object has no attribute 'getDevicesStatuses'
 
status = dashboard.devices.getDevices(org_id, device['serial'])
AttributeError: 'Devices' object has no attribute 'getDevices'
 
status = dashboard.devices.getOrganizationDevicesStatuses(org_id,serials = device['serial'])
AttributeError: 'Devices' object has no attribute 'getOrganizationDevicesStatuses'
 
Same statement with MR device
status = dashboard.organizations.getOrganizationDevicesStatuses(org_id,serials = device['serial'])
Device Name: SF99-AP1, Operational Status: online
Tod
Here to help

Thank you for the pointer.  Found the issue.  The correct line of code is as follows:

status = dashboard.organizations.getOrganizationDevicesStatuses(org_id,serials = device['serial'])
Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.