Report with current device firmware included

Jason_42
Conversationalist

Report with current device firmware included

I have to provide a monthly report that is used by various departments in my organization. Unfortunately, I have yet to figure out how to easily get a report showing the following:

'Name / Model / Serial Number / MAC / Current Firmware Version / Date Firmware Applied'

 

Canned reports have some of the info for some strange reason doesn't show the current firmware version.

We have been able to pull it from API but have to manipulate it in Excel to remove duplicate entries showing past upgrades.

Along the way I have also noticed that in the GUI, on the appliance status page, the Current Version listed is different than what I can pull from the API. We are using Python in Visual Studio for this. Has anyone been able to get this to accurately work or is anyone able to point me in the right direction? It seems like an extremely large miss to not have that as an optional column on the Inventory page to export as a CSV. Especially considering it is obviously available since it is on the Appliance Status page.

 

I'm am very new to Python and API but this is what we have.

 

firmwareupgrades = dashboard.organizations.getOrganizationFirmwareUpgrades(org_id, total_pages='all')

for upgrade in firmwareupgrades:
devices = dashboard.networks.getNetworkDevices(upgrade['network']['id'])
for device in devices:
try:
if 'Completed' in upgrade['status']:
print(device['name'] + "," + device['model'] + "," + device['serial'] + "," + device['mac'] + "," + upgrade['toVersion']['shortName'] + "," + upgrade['time'])
else:
print(device['name'] + "," + device['model'] + "," + device['serial'] + "," + device['mac'] + "," + upgrade['fromVersion']['shortName'] + "," + upgrade['time'])
except Exception as e:
print(e)
continue

 

Any help would be greatly appreciated.

7 Replies 7
MartinS
Building a reputation

Just a quick call out to the Meraki Marketplace, as there are quite a few 3rd party apps who'll do this all for you - Cisco Meraki Marketplace | Cisco Meraki

 

Best

 

Martin

---
COO
Highlight - Service Observability Platform
www.highlight.net
Jason_42
Conversationalist

Thank for your reply MartinS,

 

However, I find it very backwards to need a 3rd party tool for this. Isn't the point of API to allow us to do exactly these kinds of things directly without the need to invest in other tools? It seems easiest solution would be for Meraki to put a check box on the Inventory page to add firmware as a column. It's very strange to me that it isn't already there.

 

Thanks,

Jason

MartinS
Building a reputation

I think it's important to keep in mind that the Meraki dashboard can't be everything for everyone, and while the API is well documented and accessible to all, very few will have the appetite, skills, time and money to develop their own applications to satisfy their specific requirements. That's where the marketplace comes in, and while apps cost money, they'll cost significantly less than your time in doing it yourself.

---
COO
Highlight - Service Observability Platform
www.highlight.net
John_on_API
Meraki Employee
Meraki Employee

Hi @Jason_42 at a glance, your script looks pretty solid (haven't tested). For classic Meraki devices you can simplify however by leveraging the relationship between network and device. For example, for classic Meraki devices, all devices of a given product type in a network have the same firmware version. So you only need firmware version once per network per product type, rather than once per device.

 

You can also leverage the fact that the FW version doesn't change unless an admin or Meraki schedules an upgrade.

 

With that in mind, another way to build the report would be to:

 

1. getOrganizationFirmwareUpgrades, which you're already polling, which gives you the completedAt timestamp (that's the one you need for each device's "date firmware applied" column), the toVersion.shortName attribute, and the productTypes attribute.

2. getOrganizationDevices instead of the deprecated getNetworkDevices, which gives you all the devices serials, models, and their product type and network IDs.

 

From there, for each device, pair it with the relevant info from getOrganizationFirmwareUpgrades. 

sungod
Kind of a big deal

That's a good shortcut, do you know how things work if there is a mix of newer and 'legacy' devices on a network? as they may actually be running different firmware versions.

 

APs for instance, according to current release notes, legacy models will be running 26.8.3 even if the wireless network is upgraded to 30.7.

 

I'm not sure what the legacy ones report, is it the version applied to the network, or is it the version they are actually running?

John_on_API
Meraki Employee
Meraki Employee

If you're using both classic Meraki and Catalyst devices, then I'd look at https://developer.cisco.com/meraki/api-v1/get-organization-firmware-upgrades-by-device/ instead. This one breaks it out by device, but might more work to consume if you're classic Meraki only.

Jason_42
Conversationalist

Thanks for additional responses to this. I've been tied up on a few other things but will take a look at suggestions and reply accordingly!

Get notified when there are additional replies to this discussion.