puppet-gnocchi/manifests/statsd.pp
ZhongShengping 654cd9c862 Add hooks for external install & svc management
This adds defined anchor points for external modules to hook into the
software install, config and service dependency chain.  This allows
external modules to manage software installation (virtualenv,
containers, etc) and service management (pacemaker) without needing rely
on resources that may change or be renamed.

Change-Id: Idc43b06eab3f7103392da699e2a77bb55ce7344d
2016-12-05 11:44:08 +08:00

78 lines
1.9 KiB
Puppet

# Installs & configure the gnocchi statsd service
#
# == Parameters
#
# [*resource_id*]
# (required) Resource UUID to use to identify statsd in Gnocchi.
#
# [*user_id*]
# (required) User UUID to use to identify statsd in Gnocchi.
#
# [*project_id*]
# (required) Project UUID to use to identify statsd in Gnocchi.
#
# [*flush_delay*]
# (required) Delay between flushes.
#
# [*enabled*]
# (optional) Should the service be enabled.
# Defaults to true
#
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
# [*manage_service*]
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*archive_policy_name*]
# (optional) Archive policy name to use when creating metrics.
# Defaults to undef.
#
class gnocchi::statsd (
$resource_id,
$user_id,
$project_id,
$flush_delay,
$archive_policy_name = undef,
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
) inherits gnocchi::params {
include ::gnocchi::deps
package { 'gnocchi-statsd':
ensure => $package_ensure,
name => $::gnocchi::params::statsd_package_name,
tag => ['openstack', 'gnocchi-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'gnocchi-statsd':
ensure => $service_ensure,
name => $::gnocchi::params::statsd_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['gnocchi-service', 'gnocchi-db-sync-service'],
}
gnocchi_config {
'statsd/resource_id' : value => $resource_id;
'statsd/user_id' : value => $user_id;
'statsd/project_id' : value => $project_id;
'statsd/archive_policy_name' : value => $archive_policy_name;
'statsd/flush_delay' : value => $flush_delay;
}
}