Custom topology script processing

Hello, dear HP community.

I have an interest needs. Let me explain. I have database query, that takes different metrics for different object in table like this:

OBJECT_NAME | start_date | end_date | datediff | avgdatediff  

obj1                    |        1.03.16 | 2.03.16      | 1            | 0,5  

obj2                    |        1.03.16 | 2.03.16      | 1            | 0,5  

obj3                    | 1.03.16        |  2.03.16     |   1          | 0,5

 ...                        | ...                |  ...               | ...           | ...


So, i need to create a lot of objects (node, business_application, doesn't matter) by OBJECT_NAME and get other columns as metrics for this object.

JS script is done and it's pretty clear for me.

But as for topology, i can't find way to take only OBJECT_NAME column and list it. As for now, i use Framework.getDestinationAttributeAsObject("metrics"). This way takes all metrics.

So, i've read about using Framework.getDestinationAttributeAsObject("monitorStorage").get(<parameter_name>). But i can't understand, how to get OBJECT_NAME column using it.

Any ideas about it?


Regards, Vitaly Vyblov

  • Community, here is another addition.

    I've found, that in js processing part of custom database query monitor, i can use monitorStorage, that can be accessed (drumroll) from Topology script!!!

    Here is usage for JS:

    you can put any data in storage using myContext.getMonitorStorage.add(<key>, <value>);

    Here is usage from topology script:

    you can take all data from monitor storage using

    allfields = Framework.getDestinationAttributeAsObject("monitorStorage")

    But there is some trouble for me: type(allfields) == org.python.core.PyJavaInstance.

    So i don't know how to list all keys from allfields, cause keys(allfields) and allfields.keys() doesn't return anything.

    I feel, that solution is close, but i need some guidance or help with that addition.

    Regards, Vitaly.


    And another one.

     From API reference, i've found that class MonitorStorage is returned by Framework.getDestinationAttributeAsObject("monitorStorage")

    but, when i'm tried to getkeys like .getKeys() method, it breaks at: AttributeError getKeys.

    I thought that it's about import, but i don't know, what to import to access to the right getKey() method.

    Any help will be appreciated.

    Regards, Vitaly.


  • Verified Answer

    Thank you, dear Community.

    Finally, i got it. Framework.getDestinationAttributeAsObject("monitorStorage") returns non-python class.

    It's java HashMap. So, allfields.keySet() returns a Set view of the keys contained in this map.

    Hope, it helps to someone else.

    Regards, Vitaly.

Reply Children
No Data