When getting the list of devices for a given org from the following endpoint, appliances include the wan1Ip and wan2Ip, but not the lanIp. However, for devices like cameras and wireless, this endpoint provides the lanIp. I need a way to get the lanIp of appliances, so when I add them to my monitoring platform the it can contact the devices on an internal IP.
Thoughts on how one might programmatically get the lanIp for MX Security Appliances?
Thanks.
curl -L --request GET \
--url 'https://api.meraki.com/api/v1/organizations/OrgId/devices' \
--header 'Authorization: Bearer ApiKey' \
--header 'Accept: application/json'
If you are talking about VLANs you can do it with this one.
Get Network Appliance Vlans - Meraki Dashboard API v1 - Cisco Meraki Developer Hub
Otherwise you can use this one.
Get Organization Devices Statuses - Meraki Dashboard API v1 - Cisco Meraki Developer Hub
This is the response I get for the first MX. Given this response, how might I determine the lanIp?
Thanks.
curl -L --request GET \
--url 'https://api.meraki.com/api/v1/organizations/OrgId/devices/statuses' \
--header 'Authorization: Bearer ApiKey' \
--header 'Accept: application/json'
[
{"name":"XXXX-XXX-MX1",
"serial":"XXXX-XXXX-6599",
"mac":"XX:XX:XX:XX:68:68",
"publicIp":"203.XXX.42.110",
"networkId":"L_69805794224244XXXX",
"status":"online",
"lastReportedAt":"2024-02-08T22:03:05.007000Z",
"productType":"appliance",
"components":{"powerSupplies":[]},
"model":"MX100",
"tags":[],
"usingCellularFailover":false,
"wan1Ip":"203.XXX.42.110",
"wan1Gateway":"203.XXX.42.109",
"wan1IpType":"static",
"wan1PrimaryDns":"1.0.0.1",
"wan1SecondaryDns":"8.8.8.8",
"wan2Ip":"10.0.100.5",
"wan2Gateway":"10.0.100.1",
"wan2IpType":"dhcp",
"wan2PrimaryDns":"1.0.0.1",
"wan2SecondaryDns":"8.8.8.8"}
The MX does not have LAN IP, It has the WAN IP or VLAN IP.
You can get both with two links that I sent to you.
Thanks. I made calls to both endpoints, and I think I follow you now. However, the vlans endpoint returns applianceIp, but no serial field. How might one resolve which of the two (primary/secondary) appliances this applianceIp belongs to?
The config for an HA pair applies to the pair. There wouldn't be different VLANs on the primary and spare.
Have you checked this one?
https://developer.cisco.com/meraki/api-v1/get-organization-uplinks-statuses/
This is what that returns for an example network with two appliances:
Great, I believe this meets your needs.
Just to be clear, you will not get all the information with a single API, you will have to use a set of APIs and work on a script to cross-reference the information.
You're going to have a little work.