aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Patil <psachin@redhat.com>2017-07-04 19:56:48 +0530
committerBryn M. Reeves <bmr@redhat.com>2017-08-08 16:32:55 +0100
commited000dcc49c872d28ad5352eedafcb40c9e5da11 (patch)
tree6aa3ddc0f94db02289667dbfc7871e2161f935ce
parentf379776da6d2d3f4e3f31bf34b12908674dc122d (diff)
downloadsos-ed000dcc49c872d28ad5352eedafcb40c9e5da11.tar.gz
[openstack_aodh] OpenStack Alarm support
New plugin to collect OpenStack Aodh configurations and logs. Signed-off-by: Sachin Patil <psachin@redhat.com> (minor style fix) Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/openstack_aodh.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/sos/plugins/openstack_aodh.py b/sos/plugins/openstack_aodh.py
new file mode 100644
index 00000000..45f848dc
--- /dev/null
+++ b/sos/plugins/openstack_aodh.py
@@ -0,0 +1,79 @@
+# Copyright (C) 2017 Red Hat, Inc., Sachin Patil <psachin@redhat.com>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import os
+from sos.plugins import Plugin, RedHatPlugin
+
+
+class OpenStackAodh(Plugin, RedHatPlugin):
+ """OpenStack Alarm service"""
+ plugin_name = "openstack_aodh"
+ profiles = ('openstack', 'openstack_controller')
+
+ packages = (
+ 'openstack-aodh-api',
+ 'openstack-aodh-listener',
+ 'openstack-aodh-notifier',
+ 'openstack-aodh-evaluator,'
+ 'openstack-aodh-common'
+ )
+
+ requires_root = False
+
+ def setup(self):
+ self.add_copy_spec("/etc/aodh/")
+
+ self.limit = self.get_option("log_size")
+ if self.get_option("all_logs"):
+ self.add_copy_spec("/var/log/aodh/",
+ sizelimit=self.limit)
+ else:
+ self.add_copy_spec("/var/log/aodh/*.log",
+ sizelimit=self.limit)
+
+ vars_all = [p in os.environ for p in [
+ 'OS_USERNAME', 'OS_PASSWORD', 'OS_AUTH_TYPE'
+ ]]
+
+ vars_any = [p in os.environ for p in [
+ 'OS_TENANT_NAME', 'OS_PROJECT_NAME'
+ ]]
+
+ if not (all(vars_all) and any(vars_any)):
+ self.soslog.warning("Not all environment variables set. Source "
+ "the environment file for the user intended "
+ "to connect to the OpenStack environment.")
+ else:
+ self.add_cmd_output([
+ "aodh --version",
+ "aodh capabilities list",
+ "aodh alarm list"
+ ])
+
+ def postproc(self):
+ self.do_file_sub(
+ "/etc/aodh/aodh.conf",
+ r"(password[\t\ ]*=[\t\ ]*)(.+)",
+ r"\1********"
+ )
+
+ self.do_file_sub(
+ "/etc/aodh/aodh.conf",
+ r"(auth_url[\t\ ]*=[\t\ ]*)(.+)",
+ r"\1********",
+ )
+
+# vim: set et ts=4 sw=4 :