Skip to content

Commit 40dec5c

Browse files
committed
Added sample code
1 parent 3aec857 commit 40dec5c

File tree

1 file changed

+149
-3
lines changed

1 file changed

+149
-3
lines changed

specs/sosreport_integration.adoc

Lines changed: 149 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ For different Tendrl services their respective plugins have to be written.
3838
** Tendrl-gluster-integration
3939
*** Rpm versions of commons, node-agent and gluster-integration
4040
*** Tendrl-node-agent service status
41-
*** Glusterd service status
4241
*** Gdeploy status
43-
*** Gluster peer status
4442
*** Configurations in /etc/tendrl/gluster-integration/
4543
*** Package requirements
4644

@@ -70,9 +68,157 @@ For different Tendrl services their respective plugins have to be written.
7068
* Since logging is common for all the Tendrl services the logs can be captured from syslog.
7169
** According to current rsyslog config the log messages are present in /var/log/messages
7270

71+
* Sample code :
72+
73+
[source, python]
74+
.tendrl-node-agent.py
75+
----
76+
from sos.plugins import Plugin
77+
78+
79+
class TendrlNodeAgent(Plugin):
80+
"""Tendrl Node Agent
81+
"""
82+
plugin_name = "tendrl_node_agent"
83+
profiles = ('tendrl',)
84+
85+
def setup(self):
86+
87+
self.limit = self.get_option("log_size")
88+
self.add_copy_spec_limit("/var/log/messages-*", sizelimit=self.limit)
89+
self.add_copy_spec("/etc/tendrl/node-agent/")
90+
self.add_cmd_output("rpm -qa | grep tendrl",
91+
suggest_filename="tendrl_rpm_version")
92+
self.add_cmd_output(["yum repolist | grep tendrl",
93+
"systemctl status tendrl-node-agent.socket"
94+
])
95+
96+
----
97+
98+
[source, python]
99+
.tendrl-gluster-integration.py
100+
----
101+
from sos.plugins import Plugin
102+
103+
104+
class TendrlGlusterIntegration(Plugin):
105+
"""Tendrl Gluster Integration
106+
"""
107+
plugin_name = "tendrl_gluster_integration"
108+
profiles = ('tendrl',)
109+
110+
def setup(self):
111+
112+
self.limit = self.get_option("log_size")
113+
self.add_copy_spec_limit("/var/log/messages-*", sizelimit=self.limit)
114+
self.add_copy_spec("/etc/tendrl/gluster-integration/")
115+
self.add_cmd_output("rpm -qa | grep tendrl",
116+
suggest_filename="tendrl_rpm_version")
117+
self.add_cmd_output("systemctl status tendrl-node-agent")
118+
----
119+
120+
[source, python]
121+
.tendrl-ceph-integration.py
122+
----
123+
from sos.plugins import Plugin
124+
125+
126+
class TendrlCephIntegration(Plugin):
127+
"""Tendrl Ceph Integration
128+
"""
129+
plugin_name = "tendrl_ceph_integration"
130+
profiles = ('tendrl',)
131+
132+
def setup(self):
133+
134+
self.limit = self.get_option("log_size")
135+
self.add_copy_spec_limit("/var/log/messages-*", sizelimit=self.limit)
136+
self.add_copy_spec("/etc/tendrl/ceph-integration/")
137+
self.add_cmd_output("rpm -qa | grep tendrl",
138+
suggest_filename="tendrl_rpm_version")
139+
self.add_cmd_output("systemctl status tendrl-node-agent")
140+
----
141+
142+
[source, python]
143+
.tendrl-performance-monitoring.py
144+
----
145+
from sos.plugins import Plugin
146+
147+
148+
class TendrlPerformanceMonitoring(Plugin):
149+
"""Tendrl Performance Monitoring
150+
"""
151+
plugin_name = "tendrl_performance_monitoring"
152+
profiles = ('tendrl',)
153+
154+
def setup(self):
155+
156+
self.limit = self.get_option("log_size")
157+
self.add_copy_spec_limit("/var/log/messages-*", sizelimit=self.limit)
158+
self.add_copy_spec("/etc/tendrl/performance-monitoring/")
159+
self.add_cmd_output("rpm -qa | grep tendrl",
160+
suggest_filename="tendrl_rpm_version")
161+
self.add_cmd_output(["systemctl status tendrl-node-agent.socket",
162+
"systemctl status carbon-cache",
163+
"ls -la /var/lib/graphite-web/graphite.db"
164+
])
165+
166+
----
167+
168+
[source, python]
169+
.tendrl-api.py
170+
----
171+
from sos.plugins import Plugin
172+
173+
174+
class TendrlApi(Plugin):
175+
"""Tendrl Node Agent
176+
"""
177+
plugin_name = "tendrl_node_agent"
178+
profiles = ('tendrl',)
179+
180+
def setup(self):
181+
182+
self.add_copy_spec("/etc/tendrl/etcd.yml")
183+
self.add_cmd_output(["ruby -v",
184+
"gem --version"
185+
])
186+
self.add_cmd_output(["systemctl status httpd.service"])
187+
----
188+
73189
=== Alternatives
74190

75-
None
191+
* Rather than creating different plugings for different tendrl services, a
192+
single plugin can also be taken into consideration.
193+
194+
[source, python]
195+
.tendrl.py
196+
----
197+
from sos.plugins import Plugin
198+
199+
class Tendrl(Plugin):
200+
"""Tendrl
201+
"""
202+
plugin_name = "tendrl"
203+
profiles = ('tendrl', 'storage')
204+
205+
def setup(self):
206+
207+
self.limit = self.get_option("log_size")
208+
self.add_copy_spec_limit("/var/log/messages-*", sizelimit=self.limit)
209+
self.add_copy_spec("/etc/tendrl/")
210+
self.add_cmd_output("rpm -qa | grep tendrl",
211+
suggest_filename="tendrl_rpm_version")
212+
self.add_cmd_output(["yum repolist | grep tendrl",
213+
"systemctl status tendrl-node-agent.socket",
214+
"systemctl status tendrl-node-agent",
215+
"systemctl status carbon-cache",
216+
"ls -la /var/lib/graphite-web/graphite.db",
217+
"ruby -v",
218+
"gem --version",
219+
"systemctl status httpd.service"
220+
])
221+
----
76222

77223
=== Data model impact:
78224

0 commit comments

Comments
 (0)