Forum Discussion

Vitor_Santos's avatar
4 years ago
Solved

Resource Inventory report - Extracting instance level props (instance group??)

Hello,

We had a recent need of compiling a list of what we monitor for a client of ours.
This client in question has a LOT of 'PingMulti' stuff through its different collectors. We've their instances arranged by Instance Groups (to categorize the different things - Network, UC, etc.).

I'm able to run a report against the collectors we want & extract the Ping Multi instances (Name, Wildvalue), however, is it possible to map the actual 'Instance Group' for each instance as well?
This would be very handy because we could handle it right away on Excel & only choose the groups we're interested (We're talking about >1000 instances - It's a HUGE client).

We've accomplished this via the API & Python, however, this should be possible within the GUI directly.
Am I missing that property or this isn't possible as of now through the GUI (Report section)?

Appreciate the help!

  • Anonymous's avatar
    Anonymous
    4 years ago

    How are you getting the instances into the groups? If you're doing it manually, it'll take a bit more work to do what you want to do. However, if you are automatically sorting instances into groups, you should be basing that on an instance level property. If so, you should be able to just use that property.

    Since this is fairly obvious and you're still having difficulties, I assume that's not an option. Your best bet would be to automatically discover the group during discovery of the instances. Active discovery is not enabled by default for that DS, but that doesn't mean you can't set it up. Setting it up might also solve some management headaches. 

    For a different but similar DS, I use the following script as my active discovery script:

    targets = hostProps.get("ping.targets")
    try {
        targets.tokenize(", ").each{
            target = it.tokenize(":")
            println("${target[1]}##${target[0]}")
        }
        return 0
    }
    catch (Exception e){return 1}

    This allows me to create a property on the device called ping.targets. That property contains a value in this format:

    MyGateway:192.168.1.1, MyServer:10.0.0.35,SomeOtherDevice.example.com:172.16.35.18, GooglePing:4.2.2.2

    The above string would result in 4 instances pinging 4 different IP addresses with four different names. It wouldn't take much to modify this script to also set a parent group for each instance based on the value in the ping.targets property:

    targets = hostProps.get("ping.targets")
    try {
        targets.tokenize(", ").each{
            target = it.tokenize(":")
            println("${target[1]}##${target[0]######auto.parentGroup=${target[2]}")
        }
        return 0
    }
    catch (Exception e){return 1}

    Then your property syntax would look like this:

    MyGateway:192.168.1.1:GroupA, MyServer:10.0.0.35:GroupB,SomeOtherDevice.example.com:172.16.35.18:GroupA, GooglePing:4.2.2.2:GroupC

    This would create four instances in three groups. Then you could automatically group instances, automatically discover instances, and you could use instance level properties on your reports. You'd want to tweak the first tokenize statement if you want to allow spaces in the group names. (targets.tokenize(",").each vs. targets.tokenize(", ").each).

2 Replies

  • 2 minutes ago, Stuart Weenig said:

    How are you getting the instances into the groups? If you're doing it manually, it'll take a bit more work to do what you want to do. However, if you are automatically sorting instances into groups, you should be basing that on an instance level property. If so, you should be able to just use that property.

    Since this is fairly obvious and you're still having difficulties, I assume that's not an option. Your best bet would be to automatically discover the group during discovery of the instances. Active discovery is not enabled by default for that DS, but that doesn't mean you can't set it up. Setting it up might also solve some management headaches. 

    For a different but similar DS, I use the following script as my active discovery script:

    
    targets = hostProps.get("ping.targets")
    try {
        targets.tokenize(", ").each{
            target = it.tokenize(":")
            println("${target[1]}##${target[0]}")
        }
        return 0
    }
    catch (Exception e){return 1}

    This allows me to create a property on the device called ping.targets. That property contains a value in this format:

    
    MyGateway:192.168.1.1, MyServer:10.0.0.35,SomeOtherDevice.example.com:172.16.35.18, GooglePing:4.2.2.2

    The above string would result in 4 instances pinging 4 different IP addresses with four different names. It wouldn't take much to modify this script to also set a parent group for each instance based on the value in the ping.targets property:

    
    targets = hostProps.get("ping.targets")
    try {
        targets.tokenize(", ").each{
            target = it.tokenize(":")
            println("${target[1]}##${target[0]######auto.parentGroup=${target[2]}")
        }
        return 0
    }
    catch (Exception e){return 1}

    Then your property syntax would look like this:

    
    MyGateway:192.168.1.1:GroupA, MyServer:10.0.0.35:GroupB,SomeOtherDevice.example.com:172.16.35.18:GroupA, GooglePing:4.2.2.2:GroupC

    This would create four instances in three groups. Then you could automatically group instances, automatically discover instances, and you could use instance level properties on your reports. You'd want to tweak the first tokenize statement if you want to allow spaces in the group names. (targets.tokenize(",").each vs. targets.tokenize(", ").each).

     

    That's actually a gr8 solution, we never looked into those in that way. Not sure if we'll implement it that way, but, thanks a lot for sharing it @Stuart Weenig!

  • Anonymous's avatar
    Anonymous

    How are you getting the instances into the groups? If you're doing it manually, it'll take a bit more work to do what you want to do. However, if you are automatically sorting instances into groups, you should be basing that on an instance level property. If so, you should be able to just use that property.

    Since this is fairly obvious and you're still having difficulties, I assume that's not an option. Your best bet would be to automatically discover the group during discovery of the instances. Active discovery is not enabled by default for that DS, but that doesn't mean you can't set it up. Setting it up might also solve some management headaches. 

    For a different but similar DS, I use the following script as my active discovery script:

    targets = hostProps.get("ping.targets")
    try {
        targets.tokenize(", ").each{
            target = it.tokenize(":")
            println("${target[1]}##${target[0]}")
        }
        return 0
    }
    catch (Exception e){return 1}

    This allows me to create a property on the device called ping.targets. That property contains a value in this format:

    MyGateway:192.168.1.1, MyServer:10.0.0.35,SomeOtherDevice.example.com:172.16.35.18, GooglePing:4.2.2.2

    The above string would result in 4 instances pinging 4 different IP addresses with four different names. It wouldn't take much to modify this script to also set a parent group for each instance based on the value in the ping.targets property:

    targets = hostProps.get("ping.targets")
    try {
        targets.tokenize(", ").each{
            target = it.tokenize(":")
            println("${target[1]}##${target[0]######auto.parentGroup=${target[2]}")
        }
        return 0
    }
    catch (Exception e){return 1}

    Then your property syntax would look like this:

    MyGateway:192.168.1.1:GroupA, MyServer:10.0.0.35:GroupB,SomeOtherDevice.example.com:172.16.35.18:GroupA, GooglePing:4.2.2.2:GroupC

    This would create four instances in three groups. Then you could automatically group instances, automatically discover instances, and you could use instance level properties on your reports. You'd want to tweak the first tokenize statement if you want to allow spaces in the group names. (targets.tokenize(",").each vs. targets.tokenize(", ").each).