diff --git a/doc/source/install-guide/configure-swift-config.rst b/doc/source/install-guide/configure-swift-config.rst index 6a48fe4bc5..129401b5cf 100644 --- a/doc/source/install-guide/configure-swift-config.rst +++ b/doc/source/install-guide/configure-swift-config.rst @@ -44,6 +44,11 @@ file** # index: 1 # repl_number: 3 # deprecated: True + # statsd_host: statsd.example.com + # statsd_port: 8125 + # statsd_metric_prefix: + # statsd_default_sample_rate: 1.0 + # statsd_sample_rate_factor: 1.0 ``part_power`` @@ -129,6 +134,27 @@ file** ``repl_number`` are the only values that can be set. Setting them in this section overrides the defaults for the specific ring. + ``statsd_host`` + Swift supports sending extra metrics to a statsd host. This option + sets the statsd host that will receive statsd metrics. Specifying + this here will apply to all hosts in the cluster. + + If statsd_host is left blank or omitted then statsd will be + disabled. + + All statsd settings can be overridden or specified deeper in the + structure if you want to only catch statsd metrics on certain hosts. + + ``statsd_port`` + Optionally, use this to specify the statsd server's port your sending + metrics to. Defaults to 8125 of omitted. + + ``statsd_default_sample_rate`` and ``statsd_sample_rate_factor`` + These statsd related options are a little more complicated and are + used to tune how many samples are sent to statsd. Omit them unless + you need to tweak these settings, if so first read: + http://docs.openstack.org/developer/swift/admin_guide.html + #. Update the Object Storage proxy hosts values: .. code-block:: yaml @@ -136,16 +162,25 @@ file** # swift-proxy_hosts: # infra-node1: # ip: 192.0.2.1 + # statsd_metric_prefix: proxy01 # infra-node2: # ip: 192.0.2.2 + # statsd_metric_prefix: proxy02 # infra-node3: # ip: 192.0.2.3 + # statsd_metric_prefix: proxy03 ``swift-proxy_hosts`` Set the ``IP`` address of the hosts that Ansible will connect to to deploy the swift-proxy containers. The ``swift-proxy_hosts`` value should match the infra nodes. + ``statsd_metric_prefix`` + This metric is optional, and also only evaluated it you have defined + ``statsd_host`` somewhere. It allows you define a prefix to add to + all statsd metrics sent from this hose. If omitted the node name will + be used. + #. Update the Object Storage hosts values: .. code-block:: yaml @@ -156,16 +191,19 @@ file** # container_vars: # swift_vars: # zone: 0 + # statsd_metric_prefix: node1 # swift-node2: # ip: 192.0.2.5 # container_vars: # swift_vars: # zone: 1 + # statsd_metric_prefix: node2 # swift-node3: # ip: 192.0.2.6 # container_vars: # swift_vars: # zone: 2 + # statsd_metric_prefix: node3 # swift-node4: # ip: 192.0.2.7 # container_vars: @@ -242,6 +280,12 @@ file** Set the names of the drives on this Object Storage host. At least one name must be specified. + ``statsd_metric_prefix`` + This metric is optional, and also only evaluated it you have defined + ``statsd_host`` somewhere. It allows you define a prefix to add to + all statsd metrics sent from this hose. If omitted the node name will + be used. + In the following example, ``swift-node5`` shows values in the ``swift_hosts`` section that will override the global values. Groups are set, which overrides the global settings for drive ``sdb``. The diff --git a/etc/openstack_deploy/conf.d/swift.yml.example b/etc/openstack_deploy/conf.d/swift.yml.example index a15a54f095..f35ae91cb7 100644 --- a/etc/openstack_deploy/conf.d/swift.yml.example +++ b/etc/openstack_deploy/conf.d/swift.yml.example @@ -85,6 +85,26 @@ # The amount of time in seconds before items, such as tombstones are # reclaimed, default is 604800 (7 Days). # +# Option: statsd_host (optional, string) +# Swift supports statsd metrics, this option sets the statsd host that will +# receive statsd metrics. Specifying this here will apply to all hosts in +# a cluster. It can be overridden or specified deeper in the structure if you +# want to only catch statsd metrics on certain hosts. +# +# Option: statsd_port (optional, integer, default 8125) +# Statsd port, requires statsd_host set. +# +# Option: statsd_metric_prefix (optional, string, default ansible_host) +# Specify a prefix that will be prepended to all metrics, this should be specified +# deeper in the configuration so different host metrics can be separated. +# +# The following statsd related options are a little more complicated and are +# used to tune how many samples are sent to statsd. If you need to tweak these +# settings then first read: http://docs.openstack.org/developer/swift/admin_guide.html +# +# Option: statsd_default_sample_rate (optional, float, default 1.0) +# Option: statsd_sample_rate_factor (optional, float, default 1.0) +# # Example: # # Define a typical deployment: @@ -109,6 +129,8 @@ # region: 1 # zone: 0 # weight: 100 +# statsd_host: statsd.example.lan +# statsd_port: 8125 # # Note: Most typical deployments override the 'zone' option in the # 'swift_vars' level to use a unique zone for each storage host. @@ -267,6 +289,23 @@ # store Object PUT replicas on up to 6 disks in region 1 assuming # replicas is 3, and write_affinity = r1 # +# Option: statsd_host (optional, string) +# Swift supports statsd metrics, this option sets the statsd host that will +# receive statsd metrics. +# +# Option: statsd_port (optional, integer, default 8125) +# Statsd port, requires statsd_host set. +# +# Option: statsd_metric_prefix (optional, string, default ansible_host) +# Specify a prefix that will be prepended to all metrics on this host. +# +# The following statsd related options are a little more complicated and are +# used to tune how many samples are sent to statsd. If you need to tweak these +# settings then first read: http://docs.openstack.org/developer/swift/admin_guide.html +# +# Option: statsd_default_sample_rate (optional, float, default 1.0) +# Option: statsd_sample_rate_factor (optional, float, default 1.0) +# # Example: # # Define three swift proxy hosts: @@ -338,6 +377,23 @@ # Option: weight (optional, integer) # Weight of all disks. # +# Option: statsd_host (optional, string) +# Swift supports statsd metrics, this option sets the statsd host that will +# receive statsd metrics. +# +# Option: statsd_port (optional, integer, default 8125) +# Statsd port, requires statsd_host set. +# +# Option: statsd_metric_prefix (optional, string, default ansible_host) +# Specify a prefix that will prepended all metrics on this host. +# +# The following statsd related options are a little more complicated and are +# used to tune how many samples are sent to statsd. If you need to tweak these +# settings then first read: http://docs.openstack.org/developer/swift/admin_guide.html +# +# Option: statsd_default_sample_rate (optional, float, default 1.0) +# Option: statsd_sample_rate_factor (optional, float, default 1.0) +# # Level: groups (optional) # List of one of more Ansible groups that apply to this host. # @@ -411,6 +467,8 @@ # region: 2 # zone: 0 # weight: 200 +# statsd_host: statsd2.example.net +# statsd_metric_prefix: swift-node4 # groups: # - account # - container diff --git a/playbooks/roles/os_swift/defaults/main.yml b/playbooks/roles/os_swift/defaults/main.yml index 8b386ec16f..6d40ab70a2 100644 --- a/playbooks/roles/os_swift/defaults/main.yml +++ b/playbooks/roles/os_swift/defaults/main.yml @@ -96,6 +96,11 @@ swift_service_adminurl: "{{ swift_service_adminuri }}/v1/AUTH_%(tenant_id)s" swift_service_internaluri: "{{ swift_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ swift_proxy_port }}" swift_service_internalurl: "{{ swift_service_internaluri }}/v1/AUTH_%(tenant_id)s" swift_service_region: RegionOne +statsd_host: +statsd_port: 8125 +statsd_default_sample_rate: 1.0 +statsd_sample_rate_factor: 1.0 +statsd_metric_prefix: ## Keystone authentication middleware swift_keystone_auth_plugin: "password" diff --git a/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 b/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 index 2dfe13dd39..fd643cbeba 100644 --- a/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 +++ b/playbooks/roles/os_swift/templates/account-server-replicator.conf.j2 @@ -10,6 +10,7 @@ bind_port = {{ swift_account_port }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} workers = {{ swift_account_server_replicator_workers | default(api_threads) }} log_facility = LOG_LOCAL2 +{% include "statsd.j2" %} [pipeline:main] pipeline = account-server diff --git a/playbooks/roles/os_swift/templates/account-server.conf.j2 b/playbooks/roles/os_swift/templates/account-server.conf.j2 index 937d28c862..411bf6cc33 100644 --- a/playbooks/roles/os_swift/templates/account-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/account-server.conf.j2 @@ -11,6 +11,7 @@ workers = {{ swift_account_server_workers | default(api_threads) }} user = {{ swift_system_user_name }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} log_facility = LOG_LOCAL2 +{% include "statsd.j2" %} [pipeline:main] pipeline = healthcheck recon account-server diff --git a/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 b/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 index 0f18864b83..90ebe5d035 100644 --- a/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 +++ b/playbooks/roles/os_swift/templates/container-reconciler.conf.j2 @@ -1,7 +1,10 @@ +# {{ ansible_managed }} + [DEFAULT] swift_dir = /etc/swift user = {{ swift_system_user_name }} log_facility = LOG_LOCAL3 +{% include "statsd.j2" %} [container-reconciler] # The reconciler will re-attempt reconciliation if the source object is not diff --git a/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 b/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 index 7420df3c58..b2aafbe40e 100644 --- a/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 +++ b/playbooks/roles/os_swift/templates/container-server-replicator.conf.j2 @@ -10,6 +10,7 @@ bind_port = {{ swift_container_port }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} workers = {{ swift_server_replicator_workers | default(api_threads) }} log_facility = LOG_LOCAL3 +{% include "statsd.j2" %} [pipeline:main] pipeline = container-server diff --git a/playbooks/roles/os_swift/templates/container-server.conf.j2 b/playbooks/roles/os_swift/templates/container-server.conf.j2 index 16372de1ce..3445b6f954 100644 --- a/playbooks/roles/os_swift/templates/container-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/container-server.conf.j2 @@ -11,6 +11,7 @@ workers = {{ swift_container_server_workers | default(api_threads) }} user = {{ swift_system_user_name }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} log_facility = LOG_LOCAL3 +{% include "statsd.j2" %} [pipeline:main] pipeline = healthcheck recon container-server diff --git a/playbooks/roles/os_swift/templates/object-expirer.conf.j2 b/playbooks/roles/os_swift/templates/object-expirer.conf.j2 index 87d8a0d0d8..cce70c8001 100644 --- a/playbooks/roles/os_swift/templates/object-expirer.conf.j2 +++ b/playbooks/roles/os_swift/templates/object-expirer.conf.j2 @@ -4,6 +4,7 @@ swift_dir = /etc/swift user = {{ swift_system_user_name }} log_facility = LOG_LOCAL4 +{% include "statsd.j2" %} [object-expirer] interval = 300 diff --git a/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 b/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 index 5193d3b792..0f66605f3e 100644 --- a/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 +++ b/playbooks/roles/os_swift/templates/object-server-replicator.conf.j2 @@ -10,6 +10,7 @@ bind_port = {{ swift_object_port }} devices = {{ swift_vars.mount_point | default(swift.mount_point) }} workers = {{ swift_object_replicator_workers | default(api_threads) }} log_facility = LOG_LOCAL4 +{% include "statsd.j2" %} [pipeline:main] pipeline = object-server diff --git a/playbooks/roles/os_swift/templates/object-server.conf.j2 b/playbooks/roles/os_swift/templates/object-server.conf.j2 index 8cff6e2f75..15ee74bbef 100644 --- a/playbooks/roles/os_swift/templates/object-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/object-server.conf.j2 @@ -12,6 +12,7 @@ user = {{ swift_system_user_name }} swift_dir = /etc/swift devices = {{ swift_vars.mount_point | default(swift.mount_point) }} log_facility = LOG_LOCAL4 +{% include "statsd.j2" %} [pipeline:main] pipeline = healthcheck recon object-server diff --git a/playbooks/roles/os_swift/templates/proxy-server.conf.j2 b/playbooks/roles/os_swift/templates/proxy-server.conf.j2 index 45fe43bd85..111fd6c6da 100644 --- a/playbooks/roles/os_swift/templates/proxy-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/proxy-server.conf.j2 @@ -11,6 +11,38 @@ workers = {{ swift_proxy_server_workers | default(api_threads) }} user = {{ swift_system_user_name }} log_facility = LOG_LOCAL1 +{% if swift_proxy_vars is defined %} +{% if swift_proxy_vars.statsd_host is defined %} +{% set statsd = 1 %} +log_statsd_host = {{ swift_proxy_vars.statsd_host | default(statsd_host) }} +{% elif swift.statsd_host is defined %} +{% set statsd = 1 %} +log_statsd_host = {{ swift.statsd_host | default(statsd_host) }} +{% endif %} +{% if statsd is defined %} +{% if swift_proxy_vars.statsd_port is defined %} +log_statsd_port = {{ swift_proxy_vars.statsd_port }} +{% else %} +log_statsd_port = {{ swift.statsd_port | default(statsd_port) }} +{% endif %} +{% if swift_proxy_vars.statsd_default_sample_rate is defined %} +log_statsd_default_sample_rate = {{ swift_proxy_vars.statsd_default_sample_rate }} +{% else %} +log_statsd_default_sample_rate = {{ swift.statsd_default_sample_rate | default(statsd_default_sample_rate) }} +{% endif %} +{% if swift_proxy_vars.statsd_sample_rate_factor is defined %} +log_statsd_sample_rate_factor = {{ swift_proxy_vars.statsd_sample_rate_factor }} +{% else %} +log_statsd_sample_rate_factor = {{ swift.statsd_sample_rate_factor | default(statsd_sample_rate_factor) }} +{% endif %} +{% if swift_proxy_vars.statsd_metric_prefix is defined %} +log_statsd_metric_prefix = {{ swift_proxy_vars.statsd_metric_prefix }} +{% else %} +log_statsd_metric_prefix = {{ swift.statsd_metric_prefix | default(inventory_hostname) }} +{% endif %} +{% endif %} +{% endif %} + [pipeline:main] pipeline = {{ swift_middleware_list | join(' ') }} diff --git a/playbooks/roles/os_swift/templates/statsd.j2 b/playbooks/roles/os_swift/templates/statsd.j2 new file mode 100644 index 0000000000..b4a9e53c5a --- /dev/null +++ b/playbooks/roles/os_swift/templates/statsd.j2 @@ -0,0 +1,32 @@ + +{% if swift_vars is defined %} +{% if swift_vars.statsd_host is defined %} +{% set statsd = 1 %} +log_statsd_host = {{ swift_vars.statsd_host | default(statsd_host) }} +{% elif swift.statsd_host is defined %} +{% set statsd =1 %} +log_statsd_host = {{ swift.statsd_host | default(statsd_host) }} +{% endif %} +{% if statsd is defined %} +{% if swift_vars.statsd_port is defined %} +log_statsd_port = {{ swift_vars.statsd_port }} +{% else %} +log_statsd_port = {{ swift.statsd_port | default(statsd_port) }} +{% endif %} +{% if swift_vars.statsd_default_sample_rate is defined %} +log_statsd_default_sample_rate = {{ swift_vars.statsd_default_sample_rate }} +{% else %} +log_statsd_default_sample_rate = {{ swift.statsd_default_sample_rate | default(statsd_default_sample_rate) }} +{% endif %} +{% if swift_vars.statsd_sample_rate_factor is defined %} +log_statsd_sample_rate_factor = {{ swift_vars.statsd_sample_rate_factor }} +{% else %} +log_statsd_sample_rate_factor = {{ swift.statsd_sample_rate_factor | default(statsd_sample_rate_factor) }} +{% endif %} +{% if swift_vars.statsd_metric_prefix is defined %} +log_statsd_metric_prefix = {{ swift_vars.statsd_metric_prefix }} +{% else %} +log_statsd_metric_prefix = {{ swift.statsd_metric_prefix | default(inventory_hostname) }} +{% endif %} +{% endif %} +{% endif %}