mirror-update: install afsmon and run from cron

afsmon reports stats on partitions, volumes and server health into
graphite via statsd.

This installs the tool in a virtualenv with a minimal config file, and
runs it every half an hour from cron.

Change-Id: I7dc57c841fcdd3775d08f116deb46464b3e21d26
This commit is contained in:
Ian Wienand 2018-06-08 13:25:06 +10:00
parent a8a319b4b3
commit f7bc31b764
2 changed files with 62 additions and 0 deletions

View File

@ -582,4 +582,49 @@ class openstack_project::mirror_update (
key_type => 'public',
key_source => 'puppet:///modules/openstack_project/reprepro/mariadb-mirror-new-gpg-key.asc',
}
# AFS Monitoring
file { '/etc/afsmon.cfg':
ensure => present,
content => template('openstack_project/mirror-update/afsmon.cfg.erb'),
replace => true,
}
vcsrepo { '/opt/afsmon':
ensure => latest,
provider => git,
revision => 'master',
source => 'https://git.openstack.org/openstack-infra/afsmon',
}
python::virtualenv { '/usr/afsmon-env':
ensure => present,
owner => 'root',
group => 'root',
timeout => 0,
# puppet-python 1.9.4 wants to guess we want "virtualenv-3", which
# we don't. Fixed in later versions.
virtualenv => 'virtualenv',
version => 3,
}
exec { 'install_afsmon' :
command => '/usr/afsmon-env/bin/pip install --upgrade /opt/afsmon',
path => '/usr/local/bin:/usr/bin:/bin',
refreshonly => true,
subscribe => Vcsrepo['/opt/afsmon'],
require => Python::Virtualenv['/usr/afsmon-env'],
}
cron { 'afsmon':
minute => [0, 30],
command => '/usr/afsmon-env/bin/afsmon stats >> /var/log/afsmon.log 2>&1',
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
require => [
Python::Virtualenv['/usr/afsmon-env'],
Exec['install_afsmon'],
File['/etc/afsmon.cfg'],
],
}
}

View File

@ -0,0 +1,17 @@
[main]
# Enable debugging output
debug = True
# If specified, all fileservers in this cell will be queried
cell = openstack.org
# You can specify a specific list of fileservers. This is appended to
# the cell fileservers if present, otherwise is the canonical list
#fileservers = afs01.dfw.openstack.org
# fileserver02.afs.company.com
# fileserver03.afs.company.com
# Options for remote statsd host if required
[statsd]
host = graphite.openstack.org
port = 8125