Home      
  
   *Discussion Forum      
  
   Blog      
  
   www.quest.com      
  
Welcome Register | Login
Welcome Guest Search | Active Topics | Members

Update / Create Registry Variable Value Via Groovy Options
fshimaya
Posted: Wednesday, March 10, 2010 8:50:47 AM
Rank: Contributing Member
Groups: Member

Joined: 9/12/2009
Posts: 17
Location: N/A
I am looking for a way to update or create scoped registry variable values from the command line. I figure that a groovy script is the answer. In looking at the RegistryServiceInterface package, I see that the setRegistryValues(java.util.List<RegistryValueInterface> rv) method holds the key in accomplishing this. The parameter looks like an array object of variable=value pairs, which works for me. So, here is what I would like the groovy script to do:

1. It uses the script parameters hostname and variable name and searches for the scoped variable.
2. The third script parameter, variable value, is then used to update the scoped registry variable. I am thinking that the setRegistryValues method can be employed here.
3. But if no registry value parameter is provided, it will simply delete the scoped registry variable (leaving the global registry intact).

Is setRegistryValues the appropriate method for this? Has anyone created a script that achieves this and wouldn't mind posting it here?

I am using both 5.2.5 and 5.5.4 versions.

Thanks.
chris_d_lee
Posted: Wednesday, March 17, 2010 4:18:45 AM
Rank: Member
Groups: Member

Joined: 4/30/2008
Posts: 7
Location: UK
Hello

I can help with part of your request.

This script reads from an input of host,value and updates a registry variable called "SupportedBy" scoped to the host value.

regSvc = server["RegistryService"]
querySvc = server["QueryService"]
//read from the input file given as an argument

inputFile = args[1]

//parse the input file, should be in the style of <host>,<target>

testOut = new StringBuilder();

new File(inputFile).eachLine {line ->

lineArray = line.toString().split(",")

host = lineArray[0]
target = lineArray[1]
queryString = "Host where name = '%" + host + "%'"
output = querySvc.queryTopologyObjects(queryString)
hostId = output.toArray()[0].getUniqueId()


regVariable = regSvc.getRegistryVariable('SupportedBy')
values = regVariable.getRegistryValues()
topologyValue = regVariable.createTopologyObjectRegistryValue(hostId)
values.add(topologyValue)
topologyValue.setDefaultValue(target)

regSvc.saveRegistryVariable(regVariable)

}

fshimaya
Posted: Saturday, April 03, 2010 3:06:47 PM
Rank: Contributing Member
Groups: Member

Joined: 9/12/2009
Posts: 17
Location: N/A
Wow, thanks Chris. Haven't check back in a while but am pleased to see your response. I will give this a try.

One question: How then would you delete the scoped registry variable (leaving the global registry intact)?

Thanks for sharing!
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

SoClean Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under DotNetNuke.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.

Disclaimer: The posts on this forum are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are those of the individual and the individual alone, and do not necessarily represent those of Quest Software.

 

 News

 

Gartner Positions Quest
as a Leader
in Magic Quadrant for
Application Performance
Monitoring

Get your copy of the report 

 

 Latest Release

 

Foglight v5.5.5
Download Product

 

  

 Related Communities
 Related Quest Tools

 

Home | Discussion Forum | Blog | www.quest.com

@ 2008 Quest Software, Inc. All rights reserved. | Terms of Use | Trademarks | Privacy | Contact Us