Welcome to RAX-AutoScaler’s documentation!

RAX-AutoScaler use the rackspace APIs to allow for scaling based on aggregate metrics across a cluster. Can be used and installed on the auto-scale group members or on a dedicated management instance.


autoscale.autoscale(group, config_data, args)[source]

This function executes scale up or scale down policy

  • group – group name
  • config_data – json configuration data
  • args – user provided arguments

This function prints error message and exit with error.

Parameters:msg – error message
Returns:1 (int) – the return code
autoscale.get_scaling_group(group, config_data)[source]

This function checks and gets active servers in scaling group

  • group – group name
  • config_data – json configuration data

scalingGroup if server state is active else null


This function checks scaling group state and determines if node is a master.

Parameters:scalingGroup – data about servers in scaling group retrieve from cloudmonitor
Returns:1 : if cluster state is unknown 2 : node is a master None : node is not a master

This function validates user arguments and data in configuration file. It calls auth class for authentication and autoscale to execute scaling policy


This function checks if file exists and is readable.

Parameters:fname – file name
Returns:file name with absolute path

This function read and returns jsons configuration data

Parameters:config_file – json configuration file name
Returns:json data
common.get_group_value(config, group, key)[source]
This function returns value in autoscale_groups section associated with
provided key.

This function instantiate the logger.


This function uses subprocess to get node uuid and cached it for future use

Returns:server uuid None
common.get_user_value(args, config, key)[source]
This function returns value associated with the key if its available in
user arguments else in json config file.
  • args – user arguments
  • config – json configuration data
  • key – key name

value associated with key

common.get_webhook_value(config, group, key)[source]
This function returns value in webhooks section of json file which is
associated with provided key.
  • group – group name
  • config – json configuration data
  • key – key name

value associated with key

common.webhook_call(config_data, group, policy, key)[source]

This function makes webhook calls.

  • config_data – json configuration data
  • group – group name
  • policy – policy type
  • key – key name
class auth.Auth(username, apikey, region, identity_type='rackspace', token_filename='/home/docs/.rax-autoscaler-token')[source]

This class implements Rackspace cloud account authentication


This method loads a token from a file, authenticate with it, and if it fails then tries to authenticate with credentials

Returns:True or False (Boolean)

This method try to authenticate with available credentials

Returns:True or False (Boolean)

This authenticate with Rackspace cloud using existing token.

Returns:True or False (Boolean)

This unauthenticate and delete token file


This loads token from a file

Returns:True or False (Boolean)

This saves token to a file

Returns:True or False (Boolean)

This queries pyrax for values

Returns:list – the return value

This returns token filename

cloudmonitor.add_cm_check(server_id, check_type, check_config)[source]
This function adds Cloud Monitoring cpu check to a server,
if it is not already present
Parameters:server_id – server identity
Returns:int – the return code 1 – Success

This function get entity for passed agent_id (agent_id := server_uuid)

Parameters:agent_id – agent id

It gets Cloud server object by server_id

cloudmonitor.get_server_ipv4(server_id, _type='public')[source]

It gets public IP v4 server address

Parameters:server_id – server id

It returns the name of a server, using cached values

Parameters:server_id – server id
Returns:d_cached_servers_name[server_id] (str)

It checks if address is valid IP v4


list servers’ id in scaling group sgid

Parameters:sgid – scaling group id
class colouredconsolehandler.ColouredConsoleHandler(stream=None)[source]

console handler with ANSI colours support Usage example:

def white_bold_underlined(self, msg):
return self.decorate(self.BOLD + self.UNDERLINE +
self.COLOR[‘white’], msg)

ref: http://cwoebker.com/posts/ansi-escape-codes

Indices and tables


Copyright 2014 Rackspace US, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.