Re: Enrichment Rule and Regular Expression (335 Views)
Reply
Esteemed Contributor
tibornad
Posts: 870
Registered: ‎06-03-2008
Message 1 of 9 (426 Views)

Enrichment Rule and Regular Expression

hello board

 

i am in the process of creating an enrichment rule in order to update a certain attribute based on another attribute. let me explain a bit more in detail.

 

we are discovering certain nodes with the "Host Connection by SNMP" job. as result we are getting certain CI instances of type UNIX where the SNMP system name starte with quotation marks:

 

"servername.domain.com"

 

now in order to be alligned with all the other nodes from other discovery jobs and devices we need to loose there quotation marks in the name attribute for the CI. one way of doing it, is to adapt the discovery script. we have done this in the past, but obviously we're loosing these changes with every CP update.

 

the other way is to create an enrichment rule which will generate the name attribute based on lets say the "Primary DNS Name" attribute. so the primar DNS name is "servername.domain.com". now i would like to create an enrichment rule which updates the name attribute by removing the quotation marks from the value of the primary dns name attribute.

 

For this purpose i am trying to update the value of the attribute "Name" with the value of the attribute "Primary DNS Name" and use the reqular expression (\w*) and the RegExp Group 1.


I have searched the documentation for more information on how to use the Regular Expression in this context, but i was not able to find anythig relevant. For example i am not totally sure on how the RegExp Group has to be used.

 

Anyone here can help me and explain how exactley i have to use RegEx in this case?

 

Thanks for your help

Please use plain text.
Advisor
James_Athi_Raj
Posts: 13
Registered: ‎07-25-2011
Message 2 of 9 (411 Views)

Re: Enrichment Rule and Regular Expression

HI..I dont prefer changing the Name attribute by an enrichment rule since name is used in the reconcilation logic of node. it might cretae duplicates based on the reconcilation rules validation.but your requirement can be meet very easily by a simple enrcihment. Regards...

Please use plain text.
Trusted Contributor
PuneetS
Posts: 103
Registered: ‎11-03-2011
Message 3 of 9 (403 Views)

Re: Enrichment Rule and Regular Expression

Why don't you copy "Host Connection by SNMP" adapater/script, Create a new adapter like "Host Connection by SNMP_Modified", Modify the script as you did in the past? I hope CP update will not modify this adapter.

Regards
Puneet

If you find this reply helpful, Click the KUDOS button on the left to say 'Thanks'
Please use plain text.
Esteemed Contributor
haytham_hosny
Posts: 659
Registered: ‎04-21-2008
Message 4 of 9 (384 Views)

Re: Enrichment Rule and Regular Expression

shouldn't go on that way cause the CP will update the adapters and remove all the modifications.

 

 

Thank you

 

Haytham Hosny
Please use plain text.
Valued Contributor
ctruong
Posts: 323
Registered: ‎11-29-2011
Message 5 of 9 (369 Views)

Re: Enrichment Rule and Regular Expression

CP update doesnt update custom script

Please use plain text.
HP Expert
Dima Gomel
Posts: 867
Registered: ‎03-09-2010
Message 6 of 9 (352 Views)

Re: Enrichment Rule and Regular Expression

What UCMDB and CP version is in use?

Regards
-Dima, HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
Click the KUDOS star on the left to say 'Thanks'
I'll be happy to be in touch at LinkedIn .
Please use plain text.
Esteemed Contributor
tibornad
Posts: 870
Registered: ‎06-03-2008
Message 7 of 9 (344 Views)

Re: Enrichment Rule and Regular Expression

uCMDB version and CP are:

 

10.01.CUP8.582

CP 12.09.1028

 

 

in the meantime i have realized that it is not possible to create an enrichment rule which will update an attribute based on itself. means i don't think it is possible to update the name attribute based on the name attribute after applying the regular expression. from my understanding this some sort of limitation which does make some sense now that i think about it.

Please use plain text.
HP Expert
Dima Gomel
Posts: 867
Registered: ‎03-09-2010
Message 8 of 9 (340 Views)

Re: Enrichment Rule and Regular Expression

I semhow agree with your findings. Let's check what we have coming from the discovery job. Please share the communication log with results for problematic destination as well as OS details there...

Regards
-Dima, HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
Click the KUDOS star on the left to say 'Thanks'
I'll be happy to be in touch at LinkedIn .
Please use plain text.
Esteemed Contributor
tibornad
Posts: 870
Registered: ‎06-03-2008
Message 9 of 9 (335 Views)

Re: Enrichment Rule and Regular Expression

the job does return snmp sysname with quotation marks. removing the marks by modifying the script is an option we have used in the past successfully. but with every new CP our changes in the script will be overwritten. obviously we could copy the script, implement the change again and use it as custom script. but in this case we prefer to use the enrichment rule. at this point we will use the enrichment rule to set the name attribute based on the Primary DNS name attribute which is being discovered correctly.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation