From f7bc31b764fd6a748ea52ee510a8c21b2ef4e6bf Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 8 Jun 2018 13:25:06 +1000 Subject: [PATCH] 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 --- .../manifests/mirror_update.pp | 45 +++++++++++++++++++ .../templates/mirror-update/afsmon.cfg.erb | 17 +++++++ 2 files changed, 62 insertions(+) create mode 100644 modules/openstack_project/templates/mirror-update/afsmon.cfg.erb diff --git a/modules/openstack_project/manifests/mirror_update.pp b/modules/openstack_project/manifests/mirror_update.pp index 2055963e56..503beb7fad 100644 --- a/modules/openstack_project/manifests/mirror_update.pp +++ b/modules/openstack_project/manifests/mirror_update.pp @@ -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'], + ], + } + } diff --git a/modules/openstack_project/templates/mirror-update/afsmon.cfg.erb b/modules/openstack_project/templates/mirror-update/afsmon.cfg.erb new file mode 100644 index 0000000000..6d9021a78f --- /dev/null +++ b/modules/openstack_project/templates/mirror-update/afsmon.cfg.erb @@ -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