Merge "Disable pmap metrics for RabbitMQ"

This commit is contained in:
Jenkins 2015-06-09 15:22:10 +00:00 committed by Gerrit Code Review
commit 3bc3de82c6
4 changed files with 24 additions and 35 deletions

View File

@ -71,13 +71,6 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
$cinder = hiera('cinder')
$management_vip = hiera('management_vip')
if $ha_deployment {
$rabbitmq_pid_file = '/var/run/rabbitmq/p_pid'
}
else {
$rabbitmq_pid_file = '/var/run/rabbitmq/pid'
}
if $ha_deployment {
$haproxy_socket = '/var/lib/haproxy/stats'
}else{
@ -97,7 +90,6 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
service_password => $nova['user_password'],
service_tenant => 'services',
keystone_url => "http://${management_vip}:5000/v2.0",
rabbitmq_pid_file => $rabbitmq_pid_file,
haproxy_socket => $haproxy_socket,
ceph_enabled => $ceph_enabled,
memcached_host => hiera('internal_address'),

View File

@ -29,8 +29,6 @@ NAME = 'rabbitmq_info'
RABBITMQCTL_BIN = '/usr/sbin/rabbitmqctl'
# Override in config by specifying 'PmapBin'
PMAP_BIN = '/usr/bin/pmap'
# Override in config by specifying 'PidFile.
PID_FILE = "/var/run/rabbitmq/pid"
# Override in config by specifying 'Vhost'.
VHOST = "/"
@ -45,7 +43,7 @@ class RabbitMqPlugin(base.Base):
super(RabbitMqPlugin, self).__init__(*args, **kwargs)
self.plugin = NAME
self.rabbitmqctl_bin = RABBITMQCTL_BIN
self.pidfile = PID_FILE
self.pidfile = None
self.pmap_bin = PMAP_BIN
self.vhost = VHOST
@ -136,29 +134,31 @@ class RabbitMqPlugin(base.Base):
'%s reports 0 memory usage. This is probably incorrect.' %
self.rabbitmqctl_bin)
# get the PID of the RabbitMQ process
try:
with open(self.pidfile, 'r') as f:
pid = f.read().strip()
except:
self.logger.error('Unable to read %s' % self.pidfile)
return
# pmap metrics are only collected if the location of the pid file is
# explicitly configured
if self.pidfile:
try:
with open(self.pidfile, 'r') as f:
pid = f.read().strip()
except:
self.logger.error('Unable to read %s' % self.pidfile)
return
# use pmap to get proper memory stats
out, err = self.execute([self.pmap_bin, '-d', pid], shell=False)
if not out:
self.logger.error('Failed to run %s' % self.pmap_bin)
return
# use pmap to get proper memory stats
out, err = self.execute([self.pmap_bin, '-d', pid], shell=False)
if not out:
self.logger.error('Failed to run %s' % self.pmap_bin)
return
out = out.split('\n')[-1]
if re.match('mapped', out):
m = re.match(r"\D+(\d+)\D+(\d+)\D+(\d+)", out)
stats['pmap_mapped'] = int(m.group(1))
stats['pmap_used'] = int(m.group(2))
stats['pmap_shared'] = int(m.group(3))
else:
self.logger.warning('%s returned something strange.' %
self.pmap_bin)
out = out.split('\n')[-1]
if re.match('mapped', out):
m = re.match(r"\D+(\d+)\D+(\d+)\D+(\d+)", out)
stats['pmap_mapped'] = int(m.group(1))
stats['pmap_used'] = int(m.group(2))
stats['pmap_shared'] = int(m.group(3))
else:
self.logger.warning('%s returned something strange.' %
self.pmap_bin)
return stats

View File

@ -21,7 +21,6 @@ class lma_collector::collectd::controller (
$service_tenant = $lma_collector::params::openstack_tenant,
$keystone_url = $lma_collector::params::keystone_url,
$nova_cpu_allocation_ratio = $lma_collector::params::nova_cpu_allocation_ratio,
$rabbitmq_pid_file = $lma_collector::params::rabbitmq_pid_file,
$memcached_host = $lma_collector::params::memcached_host,
$apache_host = $lma_collector::params::apache_status_host,
) inherits lma_collector::params {
@ -33,7 +32,6 @@ class lma_collector::collectd::controller (
# See https://github.com/pdxcat/puppet-module-collectd/issues/227
$modules = {
'rabbitmq_info' => {
'PidFile' => $rabbitmq_pid_file,
},
'check_openstack_api' => {
'Username' => $service_user,

View File

@ -76,7 +76,6 @@ class lma_collector::params {
$mysql_database = ''
$mysql_username = ''
$mysql_password = ''
$rabbitmq_pid_file = '/var/run/rabbitmq/pid'
$openstack_user = ''
$openstack_password = ''
$openstack_tenant = ''