Labelling targets in cloud control - the easy way



Inside our current cloud control system we have a large number of servers and these can be subdivided into a number of different environment types. We occasionally want do do reporting where we can differentiate between the different types of environment. Now this can easily be done with logical groups inside the system and to be honest I don't really know why i didn't do it that way, but i didn't. I opted to set the target properties of the host instead....

The process below shows how i did it and you could actually do something very similar to allocate targets to groups - the principle is the same.

So here goes - i basically want to say for a group of servers you are now a certain environment - here's how i did that:

First up i need to generate a list of servers which i want to apply this setting to - i drive this from a select statement against one of the sysman views (i picked the first one i found that had what i needed - there are probably about half a dozen with the same info). I select this in a certain format - one that i know i can use with emcli later on:

select target_name||':'||target_type||':'||'Line of Business'||':'||'EGC;'
from sysman.MGMT$OS_SUMMARY t

this generates data of the format

server1:host:Line of Business:EGC;
server2:host:Line of Business:EGC;


Where 'EGC' is the tag i want to give the servers. This is a complete list of all the servers in the system so i somehow (manually in this case) have to remove the ones i dont want.

This data i then paste directly into a file call /tmp/recs.lst

I then use emcli to 'upload' these details

# emcli login -username=username_here
Enter password :

Login successful


#emcli set_target_property_value -property_records="REC_FILE" -input_file="REC_FILE:/tmp/recs.lst"
Properties updated successfully


And that's it -done for all of the listed servers. We can now see this as a host property if we navigate to Host->target information we see EGC in the line of business field.


More usefully i can now find this information in the sysman views to be used for generating reports - this SQL for instance shows me all the hosts with the 'EGC' line of business property.

select tgt.target_name,tp.property_value from sysman.GC$TARGET_PROPERTIES tp,sysman.gc$target tgt
where property_name='orcl_gtp_line_of_bus'
and tp.target_guid=tgt.target_guid
and tgt.target_type='host'


You can even add your own property should you so wish using a similar technique.

emcli has an incredible wealth of options - pretty much anything you can do in the gui you can do + a lot of other things beside - more info here emcli



Comments