Absent Member.. VitalyVyblov Absent Member..
Absent Member..
338 views

Custom topology script processing

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Absent Member.. VitalyVyblov Absent Member..
Absent Member..

Re: Custom topology script processing

Jump to solution

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.

0 Likes
5 Replies
Absent Member.. JuanC_Monge_AMP Absent Member..
Absent Member..

Re: Custom topology script processing

Jump to solution

Hello Vitaly Vyblov,

Please verify the following information:

https://softwaresupport.hp.com/group/softwaresupport/search-result/-/facetsearch/document/KM00511296

Let me know if you need something,

Best Regards

Juan Carlos Monge Granados
Support Engineer
San José, Costa Rica
Hewlett Packard
Enterprise

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
0 Likes
Absent Member.. VitalyVyblov Absent Member..
Absent Member..

Re: Custom topology script processing

Jump to solution

JuanC_Monge,

Thank you for answer. I'm afraid, that provided self-solve doc doesn't contains any info about Sitescope Cusctom topology script and api usage.

It's all about jython, Sitescope and topology, like in ucmdb discovery adaptors *.py files with some additions.

Regards, Vitaly.

0 Likes
Absent Member.. VitalyVyblov Absent Member..
Absent Member..

Re: Custom topology script processing

Jump to solution

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.

0 Likes
Highlighted
Absent Member.. VitalyVyblov Absent Member..
Absent Member..

Re: Custom topology script processing

Jump to solution

 

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.

 

0 Likes
Absent Member.. VitalyVyblov Absent Member..
Absent Member..

Re: Custom topology script processing

Jump to solution

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.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.