Skip to content

Commit

Permalink
[gnocchi] Add support for Debian and Ubuntu.
Browse files Browse the repository at this point in the history
Adds Gnocchi plugin support for Debian and Ubuntu.

Fixes: sosreport#1927
Resolves: sosreport#1929

Signed-off-by: Chris Johnston <chris.johnston@canonical.com>
Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
  • Loading branch information
cjohnston1158 authored and Bryan Quigley committed Feb 7, 2020
1 parent cae33b5 commit 4a77a4a
Showing 1 changed file with 44 additions and 18 deletions.
62 changes: 44 additions & 18 deletions sos/plugins/gnocchi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,31 @@
# See the LICENSE file in the source distribution for further information.

import os
from sos.plugins import Plugin, RedHatPlugin
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin


class GnocchiPlugin(Plugin, RedHatPlugin):
class Gnocchi(Plugin):
"""Gnocchi - Metric as a service"""
plugin_name = "gnocchi"

profiles = ('openstack', 'openstack_controller')

packages = (
'openstack-gnocchi-metricd', 'openstack-gnocchi-common',
'openstack-gnocchi-statsd', 'openstack-gnocchi-api',
'openstack-gnocchi-carbonara'
)

requires_root = False

var_puppet_gen = "/var/lib/config-data/puppet-generated/gnocchi"

def setup(self):
self.add_copy_spec([
"/etc/gnocchi/*",
self.var_puppet_gen + "/etc/gnocchi/*",
self.var_puppet_gen + "/etc/httpd/conf/*",
self.var_puppet_gen + "/etc/httpd/conf.d/*",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/wsgi.conf",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf"
])

if self.get_option("all_logs"):
self.add_copy_spec([
"/var/log/gnocchi/*",
"/var/log/httpd/gnocchi*",
"/var/log/{}*/gnocchi*".format(self.apachepkg)
])
else:
self.add_copy_spec([
"/var/log/gnocchi/*.log",
"/var/log/httpd/gnocchi*.log",
"/var/log/{}*/gnocchi*.log".format(self.apachepkg)
])

vars_all = [p in os.environ for p in [
Expand All @@ -73,9 +60,39 @@ def setup(self):
def postproc(self):
self.do_file_sub(
"/etc/gnocchi/gnocchi.conf",
r"password=(.*)",
r"ceph_secret\s?=(.*)",
r"ceph_secret=*****",
)
self.do_file_sub(
"/etc/gnocchi/gnocchi.conf",
r"password\s?=(.*)",
r"password=*****",
)


class RedHatGnocchi(Gnocchi, RedHatPlugin):

apachepkg = 'httpd'
var_puppet_gen = "/var/lib/config-data/puppet-generated/gnocchi"

packages = (
'openstack-gnocchi-metricd', 'openstack-gnocchi-common',
'openstack-gnocchi-statsd', 'openstack-gnocchi-api',
'openstack-gnocchi-carbonara'
)

def setup(self):
super(RedHatGnocchi, self).setup()
self.add_copy_spec([
self.var_puppet_gen + "/etc/gnocchi/*",
self.var_puppet_gen + "/etc/httpd/conf/*",
self.var_puppet_gen + "/etc/httpd/conf.d/*",
self.var_puppet_gen + "/etc/httpd/conf.modules.d/wsgi.conf",
self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf"
])

def postproc(self):
super(RedHatGnocchi, self).postproc()
self.do_file_sub(
self.var_puppet_gen + "/etc/gnocchi/"
"gnocchi.conf",
Expand All @@ -84,4 +101,13 @@ def postproc(self):
)


class DebianGnocchi(Gnocchi, DebianPlugin, UbuntuPlugin):

apachepkg = 'apache'

packages = (
'gnocchi-api', 'gnocchi-metricd', 'gnocchi-common'
'gnocchi-statsd', 'python3-gnocchiclient'
)

# vim: set et ts=4 sw=4 :

0 comments on commit 4a77a4a

Please sign in to comment.