1
votes

I have a script that sets a Custom JVM Property at each of the node agents, but I also want it to do the same at the dmgr level. I'm having a hard time getting the id for the dmgr jvm. Here's my nodeagent script. I'm really struggling with the list, listServers, getid differences.

Thanks to covener's comment, here's the working script

List deplyment manager server

dmgrServer = AdminTask.listServers('[-serverType DEPLOYMENT_MANAGER]').splitlines()

for jvm in dmgrServer: # get dmgr jvm id jvmid = AdminConfig.list('JavaVirtualMachine', jvm) # create new property AdminConfig.create('Property', jvmid, '[[validationExpression ""] [name "MyProperty"] [description "Do cool stuff"] [value "true"] [required "false"]]')

Get all the node agent servers

nodeagents = AdminTask.listServers('[-serverType NODE_AGENT]').splitlines()

for nodeagent in nodeagents: # get the id of the JVM for this node agent server jvmid = AdminConfig.list('JavaVirtualMachine', nodeagent) # set the custom property AdminConfig.create('Property', jvmid, '[[validationExpression ""] [name "MyProperty"] [description "Do cool stuff"] [value "true"] [required "false"]]')

save the configuration changes

AdminConfig.save()

sync all active nodes

AdminNodeManagement.syncActiveNodes()

1
Does the AdminTask.listServers('[-serverType DEPLOYMENT_MANAGER]') not work on your cell? It worked for me. - covener
Thank you. I couldn't find the list of serverType objects. This was exactly what I wanted. Now my script creates a property on the dmgr and nodeagent jvms in a consistent and easy to read way. - Oscar H

1 Answers

2
votes

Adding comment as an answer:

DEPLOYMENT_MANAGER is a valid server type, so it can be handled exactly the same as the NODE_AGENT loop:

dmgrServer = AdminTask.listServers('[-serverType DEPLOYMENT_MANAGER]').splitlines()