aboutsummaryrefslogtreecommitdiffstats
path: root/sos/plugins/cman.py
blob: cc0ef89a584faf55b8ac33767561bfebd578877a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.

from sos.plugins import Plugin, RedHatPlugin
import re
from glob import glob


class Cman(Plugin, RedHatPlugin):
    """cman based Red Hat Cluster High Availability
    """

    plugin_name = "cman"
    profiles = ("cluster",)

    packages = [
        "luci",
        "cman",
        "clusterlib",
    ]

    files = ["/etc/cluster/cluster.conf"]

    debugfs_path = "/sys/kernel/debug"
    _debugfs_cleanup = False

    def setup(self):

        self.add_copy_spec([
            "/etc/cluster.conf",
            "/etc/cluster",
            "/etc/sysconfig/cluster",
            "/etc/sysconfig/cman",
            "/var/log/cluster",
            "/etc/fence_virt.conf",
            "/var/lib/luci/data/luci.db",
            "/var/lib/luci/etc",
            "/var/log/luci"
        ])

        self.add_cmd_output([
            "cman_tool services",
            "cman_tool nodes",
            "cman_tool status",
            "ccs_tool lsnode",
            "mkqdisk -L",
            "group_tool dump",
            "fence_tool dump",
            "fence_tool ls -n",
            "clustat",
            "rg_test test /etc/cluster/cluster.conf"
        ])

    def postproc(self):
        for cluster_conf in glob("/etc/cluster/cluster.conf*"):
            self.do_file_sub(
                cluster_conf,
                r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")",
                r"\1%s" % ('"***"')
            )

        self.do_path_regex_sub(
            "/var/lib/luci/etc/.*\.ini",
            r"(.*secret\s*=\s*)\S+",
            r"\1******"
        )
        return

# vim: et ts=4 sw=4