Forum Discussion

ydurguner's avatar
2 years ago
Solved

Meraki Cloud Devices doesn't get pulled for monitoring when using api or snmp, need help!

Hello all,

Going all by the book, following each step on LM support page for meraki cloud monitoring, but no lock getting the devices listed.

snmp v2c, v3 no luck, providing api key from the dashboard just gives me the organizations and their device counts but no luck seeing devices.

Tried using previous existing environment we have, i still can’t get this setup for the customer specifically. Any help?

I also keep getting snmp community connection error, where it says it couldn’t communicate with snmp.

  • FWIW: we couldn’t use the netscan provided by LM. We had to tweak it:

    excludedNetworks = []
    import com.santaba.agent.util.GroovyScriptShell
    import com.logicmonitor.mod.Snippets
    modLoader = GroovyScriptShell.getInstance().getScript("Snippets", Snippets.getLoader()).withBinding(getBinding())
    meraki = modLoader.load("cisco.meraki", "0")
    def token = "<<<<<your api token here>>>>>"
    List<String> orgsAllowed = ['123456789123456789']
    Boolean debug = false
    orgs = meraki.cachedHttpGet(token, "/organizations")
    orgs.each { org ->
    def orgId = org.id
    if (orgsAllowed != null) {
    if (!orgsAllowed.contains(orgId.toString())) {return}
    }
    def orgName = org.name
    def networks = []
    def devices = []
    try {
    networks = meraki.cachedHttpGet(token, "/organizations/${orgId}/networks")
    devices = meraki.cachedHttpGet(token, "/organizations/${orgId}/devices")
    } catch (Exception error) {
    if (debug) println error.message
    return
    }
    networks.each { network ->
    def networkId = network.id
    if (excludedNetworks.contains(networkId)) {return}
    def networkDevices = devices.findAll{it.networkId == networkId}
    if (networkDevices.size() == 0) {return}
    def networkName = network.name.replaceAll('##','--')
    def networkTags = network.tags.join(",")
    def hostName = "${orgName.replaceAll('\\W', '')}.${networkName.replaceAll('\\W', '')}.invalid"
    def displayName = "Meraki Network: ${networkName}"
    println("${hostName}##${displayName}##meraki.org.name=${orgName}##meraki.org.id=${orgId}##meraki.api.key=${token}##meraki.network.id=${networkId}##meraki.network.name=${networkName}##meraki.network.tags=${networkTags}##system.categories=NoPing")
    }
    if (networks.size() > 0) {
    println("${orgName.replaceAll('\\W', '')}.invalid##Meraki Org: ${orgName}##meraki.org.name=${orgName}##meraki.org.id=${orgId}##meraki.api.key=${token}")
    }
    }
    apiDevice = ["api.meraki.com", "api.meraki.com", "meraki.api.key=${token}"].join("##")
    println(apiDevice)
    return 0

    Replace the token value with your token value and your orgsAllowed with the orgs you want to discover. Run it in the debug console of the collector that will be doing your collection.

    If that only outputs Orgs, there might be something wrong with the permissions on your token.

    After you get that working, make sure that SNMP is enabled on the network and put the community string as a property on the discovered network (snmp.community). 

    Also, after/if the networks get discovered, you’ll probably need to kick off discovery manually on each network. Not sure why it doesn’t work automatically.

10 Replies

  • FWIW: we couldn’t use the netscan provided by LM. We had to tweak it:

    excludedNetworks = []
    import com.santaba.agent.util.GroovyScriptShell
    import com.logicmonitor.mod.Snippets
    modLoader = GroovyScriptShell.getInstance().getScript("Snippets", Snippets.getLoader()).withBinding(getBinding())
    meraki = modLoader.load("cisco.meraki", "0")
    def token = "<<<<<your api token here>>>>>"
    List<String> orgsAllowed = ['123456789123456789']
    Boolean debug = false
    orgs = meraki.cachedHttpGet(token, "/organizations")
    orgs.each { org ->
    def orgId = org.id
    if (orgsAllowed != null) {
    if (!orgsAllowed.contains(orgId.toString())) {return}
    }
    def orgName = org.name
    def networks = []
    def devices = []
    try {
    networks = meraki.cachedHttpGet(token, "/organizations/${orgId}/networks")
    devices = meraki.cachedHttpGet(token, "/organizations/${orgId}/devices")
    } catch (Exception error) {
    if (debug) println error.message
    return
    }
    networks.each { network ->
    def networkId = network.id
    if (excludedNetworks.contains(networkId)) {return}
    def networkDevices = devices.findAll{it.networkId == networkId}
    if (networkDevices.size() == 0) {return}
    def networkName = network.name.replaceAll('##','--')
    def networkTags = network.tags.join(",")
    def hostName = "${orgName.replaceAll('\\W', '')}.${networkName.replaceAll('\\W', '')}.invalid"
    def displayName = "Meraki Network: ${networkName}"
    println("${hostName}##${displayName}##meraki.org.name=${orgName}##meraki.org.id=${orgId}##meraki.api.key=${token}##meraki.network.id=${networkId}##meraki.network.name=${networkName}##meraki.network.tags=${networkTags}##system.categories=NoPing")
    }
    if (networks.size() > 0) {
    println("${orgName.replaceAll('\\W', '')}.invalid##Meraki Org: ${orgName}##meraki.org.name=${orgName}##meraki.org.id=${orgId}##meraki.api.key=${token}")
    }
    }
    apiDevice = ["api.meraki.com", "api.meraki.com", "meraki.api.key=${token}"].join("##")
    println(apiDevice)
    return 0

    Replace the token value with your token value and your orgsAllowed with the orgs you want to discover. Run it in the debug console of the collector that will be doing your collection.

    If that only outputs Orgs, there might be something wrong with the permissions on your token.

    After you get that working, make sure that SNMP is enabled on the network and put the community string as a property on the discovered network (snmp.community). 

    Also, after/if the networks get discovered, you’ll probably need to kick off discovery manually on each network. Not sure why it doesn’t work automatically.

  • mray's avatar
    mray
    Icon for LM Conqueror rankLM Conqueror

    Thank you @Patrick Rouse! Yes, a support ticket is the best route for assistance with your specific environment and needs. 

    One thing that might also help is testing API endpoints here: https://developer.cisco.com/meraki/api-v1/

    Good starting point is the /organizations endpoint which is mentioned in our setup doc: https://developer.cisco.com/meraki/api-v1/#!get-organizations

    LM Meraki setup doc: https://www.logicmonitor.com/support/monitoring/networking-firewalls/cisco-meraki-monitoring

  • I’ve enjoyed bringing many Meraki networks into our monitoring over the last month. The newish Cisco_Meraki modules work great, although it took me awhile to create my own standard which I now use to for adding devices:

    GROUP Properties needed for SNMP v3:
    meraki.api.key = 
    meraki.org.id =
    meraki.org.name =
    snmp.auth = "SHA"
    snmp.authToken = auth password
    snmp.priv = "AES128"
    snmp.privToken = privacy password 

    DEVICE Properties needed for SNMP v3:
    meraki.network.id = “L/N_...”
    meraki.network.name = 
    snmp.security = “o/...”
    snmp.port = "16100"
    snmp.version = "v3" 

    system.categories = "MerakiAPINetwork,NoPing" or “MerakiAPIOrg,MerakiAPINetwork,NoPing”

  • @ydurguner, do you happen to have an active support case I could reference?

  • @ydurguner, do you happen to have an active support case I could reference?

    I currently don’t, should I open one?  As far as I believe this should have worked right out of the box after following the instructions from LM website. I haven’t had a chance to try Stuart’s method below your response.

  • @ydurguner, do you happen to have an active support case I could reference?

    opened a ticket, request  419551

  • So, after I realized there was an update available for the lm module for cisco api, I got pulled out all the locations but then it shows device counts, not the devices themselves to be monitored. Using the API key with all the configurations, actual meraki devices can be monitored or not?

    snmp.meraki.com with snmp meraki cloud monitoring seems to be no longer applicable to LM. any idea?

  • Also, when you add snmp.meraki.com as a monitored resource, what type of device needs to be selected? since meraki cloud monitoring thru snmp, does it fall under other?