Forum Discussion

ydurguner's avatar
ydurguner
Icon for Neophyte rankNeophyte
2 years ago

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 dashbo...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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.