summaryrefslogtreecommitdiffstats
path: root/overview.py
blob: 9dc90f951f006d40ce0a6ebaae3e7c17fc1c967e (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/env python
# vim: set fileencoding=UTF-8:
# Copyright 2013 Red Hat, Inc.
# Author: Jan Pokorný <jpokorny at redhat dot com>
# Distributed under GPLv2+;  generated content under CC-BY-SA 3.0
# (to view a copy, visit http://creativecommons.org/licenses/by-sa/3.0/)
"""Model of cman-based cluster capturing deployment, communication, etc.

By default, output is a PDF file named as per this script modulo extension.
Generally, you can specify arbitrary format/extension supported by graphviz
as a first parameter and you'll get what you ask for, including original
'.dot' file for further utilization.

If you generate mere dot file (./overview.py dot), you can view it
conveniently using XDot: http://code.google.com/p/jrfonseca/wiki/XDot
"""
# TODO: integrate ^^^? http://code.google.com/p/jrfonseca/wiki/XDot#Embedding

from sys import argv
from os.path import splitext
from lib import *


FONT = 'Inconsolata'
FONTDEF = map(lambda switch: '-' + switch + 'fontname=' + FONT, "GNE")
BLACKLIST = ()
#BLACKLIST = (Daemon,)
OUTPUT = splitext(__file__)[0]


graph = lambda: \
LibDot('Cluster.conf-related tools',
    overlap='scalexy',
    compound='true',
    splines='yes',
    # , ranksep='1.2',
    _subgraphs=[
        # management client
        LibSubgraph('cluster-climgmt',
            label='management client',
            _nodes=[
                Program('luci'),
                Program('ccs'),
            ]
        ),
        # other monitoring
        LibSubgraph('cluster-monitor',
            label='other monitoring',
            _nodes=[
                Program('snmpwalk'),
                Program('wbemcli'),
            ]
        ),
        # nodes
        LibSubgraph('cluster-nodes',
            style='invis',
            _subgraphs=[
                # node a
                GraphNode('cluster-node_a',
                    label='NODE A',
                    _subgraphs=[
                        # node a - management
                        GraphSubnode('cluster-node_a-conga',
                            label='management (incomplete)',
                            _nodes=[
                                Daemon('node_a-ricci',
                                    label='ricci'),
                                Daemon('node_a-modclusterd',
                                    label='modclusterd'),
                            ]
                        )
                    ]
                ),
                # node b
                GraphNode('cluster-node_b',
                    label='NODE B',
                    _subgraphs=[
                        # node b - management
                        GraphSubnode('cluster-node_b-conga',
                            label='management',
                            _nodes=[
                                Agent('node_b-libClusterMonitorSnmp.so', label='libClusterMonitorSnmp.so'),
                                Agent('node_b-libRedHatClusterProvider.so', label='libRedHatClusterProvider.so'),
                                Artefact('node_b-clumond.sock', label='/var/run/clumond.sock'),
                                Daemon('node_b-ricci', label='ricci'),
                                Daemon('node_b-modclusterd', label='modclusterd'),
                                Program('node_b-modcluster', label='modcluster'),
                            ],
                            _edges=[
                                Consume('node_b-libClusterMonitorSnmp.so', 'node_b-clumond.sock'),
                                Consume('node_b-libRedHatClusterProvider.so', 'node_b-clumond.sock'),
                                Consume('node_b-modcluster', 'node_b-clumond.sock'),
                                Produce('node_b-modclusterd', 'node_b-clumond.sock'),
                            ]
                        ),
                        # node b - core
                        GraphSubnode('cluster-node_b-core',
                            label='core',
                            _nodes=[
                                LibNode('node_b-libccsconfdb', label='libccsconfdb'),
                                Daemon('node_b-rgmanager', label='rgmanager'),
                                Program('node_b-clustat', label='clustat'),
                                Artefact('node_b-rgmanager.sk', label='/var/run/cluster/rgmanager.sk'),
                            ],
                            _edges=[
                                Consume('node_b-clustat', 'node_b-rgmanager.sk'),
                                Consume('node_b-rgmanager', 'node_b-libccsconfdb'),
                                Produce('node_b-rgmanager', 'node_b-rgmanager.sk'),
                            ]
                        )
                    ],
                    _nodes=[
                        Artefact('node_b-cluster.conf', label='/etc/cluster/cluster.conf'),
                        Daemon('node_b-snmpd', label='snmpd'),
                        Daemon('node_b-cimserver', label='cimserver'),
                    ],
                    _edges=[
                        Consume('node_b-modcluster', 'node_b-cluster.conf', label='version?'),
                        Consume('node_b-modclusterd', 'node_b-cluster.conf', label='version?'),
                        Consume('node_b-libccsconfdb', 'node_b-cluster.conf', label='version?'),
                        Consume('node_b-ricci', 'node_b-cluster.conf', label='clustername\nclusteralias'),
                        Consume('node_b-snmpd', 'node_b-libClusterMonitorSnmp.so'),
                        Consume('node_b-cimserver', 'node_b-libRedHatClusterProvider.so'),
                        DelegateOddjobExec('node_b-ricci', 'node_b-modcluster'),
                    ]
                ),
                # node c - general
                GraphNode('cluster-node_c',
                    label='NODE C',
                    _subgraphs=[
                        # node c - management
                        GraphSubnode('cluster-node_c-conga',
                            label='management (incomplete)',
                            _nodes=[
                                Daemon('node_c-ricci',
                                    label='ricci'),
                                Daemon('node_c-modclusterd',
                                    label='modclusterd')
                            ]
                        )
                    ]
                )
            ]
        ),
    ],
    _nodes=[
        Program('firefox')
    ],
    _edges=[
        DelegateRICCIRPC('luci', 'node_a-ricci', ltail='cluster-climgmt', constraint='false'),
        DelegateRICCIRPC('luci', 'node_b-ricci', ltail='cluster-climgmt'),
        DelegateRICCIRPC('luci', 'node_c-ricci', ltail='cluster-climgmt', constraint='false'),
        DelegateLuciHTTPS('firefox', 'luci'),

        DelegateSNMP('snmpwalk', 'node_b-snmpd'),
        DelegateCIM('wbemcli', 'node_b-cimserver'),

        Exchange('node_a-modclusterd', 'node_b-modclusterd', label='port 16851 (either direction)', constraint='false'),
        Exchange('node_a-modclusterd', 'node_c-modclusterd', label='port 16851 (either direction)', constraint='false'),
        Exchange('node_b-modclusterd', 'node_c-modclusterd', label='port 16851 (either direction)', constraint='false'),
    ]
)


###


if __name__ == '__main__':
    main(graph, argv, *FONTDEF, blacklist=BLACKLIST, output=OUTPUT)