Forum Discussion

Jason's avatar
3 years ago

Ping between all collectors?

Has anyone done any kind of data source which would basically do a full mesh ping between collectors? We have 20 or so collectors spread across different sites and WAN links and it would be extremely useful to monitor reachability between them all. It seems like this wouldn't be too hard as LM knows about all the collectors and could have some sort of wildcard ping between them. But adding them all individually through multi-ping is a royal pain. Any ideas on that?

Thanks,

Jason

5 Replies

  • Anonymous's avatar
    Anonymous

    No time right now to go into details, but write a propertysource that sets the IP addresses of all collectors (or all collectors in the same group) as a property on the collector. Then use active discovery on pingMulti to create the individual instances. Will provide more detail later.

  • On 5/25/2021 at 2:39 PM, Stuart Weenig said:

    No time right now to go into details, but write a propertysource that sets the IP addresses of all collectors (or all collectors in the same group) as a property on the collector. Then use active discovery on pingMulti to create the individual instances. Will provide more detail later.

    Thank you this is great - any chance you have a little more detail on how to do this or maybe an example that would point me in the right direction?

    Thanks,

    Jason

  • Anonymous's avatar
    Anonymous

    Oh right, sorry. There would be two major parts to this. The first would be to write a property source. Apply that property source to anything using 'hasCategory("collector")' as the AppliesTo. Write a script to set the IP addresses you want that collector to ping as a property (collectorpeers.ips for example). You could use the LM API to get the IP addresses of the collectors, although that could be version 1.1. 

    Then you need to work on the pingMulti datasource. Even if you're not using this for something else already, clone it and make the changes to the clone. Apply it to any device that has the property you set in the property source. Then enable active discovery and use a script like this to create the instances:

    try{
        hostProps.get("collectorpeers.ips").tokenize(",").each{
            target = it.tokenize("|")
            println(target[0] + "##" + target[1])
        }
        return 0
    } catch (Exception e){return 1}

    This assumes that the value of the property set by your property source is: ip1|name1,ip2|name2,ip3|name3,etc.

    Discovery will get the instances created, which will be the list of all IPs of all collectors.

  • 36 minutes ago, Stuart Weenig said:

    Oh right, sorry. There would be two major parts to this. The first would be to write a property source. Apply that property source to anything using 'hasCategory("collector")' as the AppliesTo. Write a script to set the IP addresses you want that collector to ping as a property (collectorpeers.ips for example). You could use the LM API to get the IP addresses of the collectors, although that could be version 1.1. 

    Then you need to work on the pingMulti datasource. Even if you're not using this for something else already, clone it and make the changes to the clone. Apply it to any device that has the property you set in the property source. Then enable active discovery and use a script like this to create the instances:

    try{
        hostProps.get("collectorpeers.ips").tokenize(",").each{
            target = it.tokenize("|")
            println(target[0] + "##" + target[1])
        }
        return 0
    } catch (Exception e){return 1}

    This assumes that the value of the property set by your property source is: ip1|name1,ip2|name2,ip3|name3,etc.

    Discovery will get the instances created, which will be the list of all IPs of all collectors.

    Ok thanks again - I have this working with a propertysource script and manually entered string of collector IPs and names. I created a cloned datasource "PingMulti_WAN-" and AppliesTo: "auto.collectorpeers.ips".

    Is it possible in the propertysource to programmatically get the collector ips or does that just have to be done externally? One downside of the static list (besides that it is static) is it adds the local collector to the list and pinging itself isn't necessary of course.

    Thanks again,

    Jason

  • Anonymous's avatar
    Anonymous

    Yes, you could add LM API calls into your property source script to pull the list of collectors' IP addresses. Then you can parse the IP addresses and exclude the collector's own IP address.