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.
- GitHub repository: https://github.com/boxidau/rax-autoscaler
- PyPI package: https://pypi.python.org/pypi/rax-autoscaler
- Stories in Ready: https://badge.waffle.io/boxidau/rax-autoscaler.svg?label=ready&title=Ready)](http://waffle.io/boxidau/rax-autoscaler
Contents:
- autoscale.autoscale(group, config_data, args)[source]¶
This function executes scale up or scale down policy
Parameters: - group – group name
- config_data – json configuration data
- args – user provided arguments
- autoscale.exit_with_error(msg)[source]¶
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
Parameters: - group – group name
- config_data – json configuration data
Returns: scalingGroup if server state is active else null
- autoscale.is_node_master(scalingGroup)[source]¶
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
- autoscale.main()[source]¶
This function validates user arguments and data in configuration file. It calls auth class for authentication and autoscale to execute scaling policy
- common.check_file(fname)[source]¶
This function checks if file exists and is readable.
Parameters: fname – file name Returns: file name with absolute path
- common.get_config(config_file)[source]¶
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.
- common.get_machine_uuid()[source]¶
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.
Parameters: - args – user arguments
- config – json configuration data
- key – key name
Returns: 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.
Parameters: - group – group name
- config – json configuration data
- key – key name
Returns: value associated with key
- common.webhook_call(config_data, group, policy, key)[source]¶
This function makes webhook calls.
Parameters: - 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
- authenticate()[source]¶
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)
- authenticate_credentials()[source]¶
This method try to authenticate with available credentials
Returns: True or False (Boolean)
- 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
- cloudmonitor.get_entity(agent_id)[source]¶
This function get entity for passed agent_id (agent_id := server_uuid)
Parameters: agent_id – agent id
- cloudmonitor.get_server_ipv4(server_id, _type='public')[source]¶
It gets public IP v4 server address
Parameters: server_id – server id
- cloudmonitor.get_server_name(server_id)[source]¶
It returns the name of a server, using cached values
Parameters: server_id – server id Returns: d_cached_servers_name[server_id] (str)
- cloudmonitor.scaling_group_servers(sgid)[source]¶
list servers’ id in scaling group sgid
Parameters: sgid – scaling group id
Indices and tables¶
License¶
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.