[StarCluster] Acquire the private IP via Starcluster as API

Håvard Wahl Kongsgård haavard.kongsgaard at gmail.com
Thu Jun 7 04:23:44 EDT 2012


Thanks!

-håvard

On Wed, Jun 6, 2012 at 5:31 PM, Justin Riley <jtriley at mit.edu> wrote:
> Hi Håvard,
>
> My apologies for the lack of documentation for the API - it's a major
> item on the todo list. For now here's a rough overview to print all of
> the private ip addresses for all nodes in a cluster:
>
> ============================================================
> from starcluster import config
> from starcluster import cluster
>
> # Load the config
> cfg = config.StarClusterConfig().load()
> # Create a cluster "manager" object
> cm = cluster.ClusterManager(cfg)
> # Fetch an active cluster
> cl = cm.get_cluster('mycluster')
> # Iterate through the nodes and print the private ip address
> for node in cl.nodes:
>    print "%s: %s" % (node.alias, node.private_ip_address)
> ============================================================
>
> You can also fetch a specific node by name:
>
> node = cl.get_node_by_alias('node003')
>
> or by instance id:
>
> node = cl.get_node_by_id('i-99999')
>
> or by the instance's dns name:
>
> node = cl.get_node_by_id('ec2-blahblah.amazonaws.com')
>
> Hope that helps,
>
> ~Justin
>
> On Mon, Jun 04, 2012 at 02:34:51PM +0200, Håvard Wahl Kongsgård wrote:
>> Hi, I'am looking for a way to acquire the private IP's for current
>> instances via the Starcluster API. There is not much documentation for
>> how to use the Starcluster API, can anyone guide me in the right
>> direction?
>>
>> --
>> Håvard Wahl Kongsgård
>> Faculty of Medicine &
>> Department of Mathematical Sciences
>> NTNU
>>
>> http://havard.security-review.net/
>>
>> _______________________________________________
>> StarCluster mailing list
>> StarCluster at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/starcluster



-- 
Håvard Wahl Kongsgård
NTNU

http://havard.security-review.net/



More information about the StarCluster mailing list