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
|
### 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 os
class rhn(Plugin, RedHatPlugin):
"""RHN Satellite related information
"""
satellite = False
proxy = False
option_list = [("log", 'gathers all apache logs', 'slow', False)]
def default_enabled(self):
return False
def rhn_package_check(self):
self.satellite = self.is_installed("rhns-satellite-tools") \
or self.is_installed("spacewalk-java") \
or self.is_installed("rhn-base")
self.proxy = self.is_installed("rhns-proxy-tools") \
or self.is_installed("spacewalk-proxy-management") \
or self.is_installed("rhn-proxy-management")
return self.satellite or self.proxy
def check_enabled(self):
# enable if any related package is installed
return self.rhn_package_check()
def setup(self):
self.rhn_package_check()
self.add_copy_specs([
"/etc/httpd/conf*",
"/etc/rhn",
"/var/log/rhn*"])
if self.get_option("log"):
self.add_copy_spec("/var/log/httpd")
# all these used to go in $DIR/mon-logs/
self.add_copy_specs([
"/opt/notification/var/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*"])
# monitoring scout logs
self.add_copy_specs([
"/home/nocpulse/var/*.log*",
"/home/nocpulse/var/commands/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*",
"/var/log/nocpulse/*.log*",
"/var/log/notification/*.log*",
"/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log"])
self.add_copy_spec("/root/ssl-build")
self.add_cmd_output("/usr/bin/rhn-schema-version",
root_symlink = "database-schema-version")
self.add_cmd_output("/usr/bin/rhn-charsets",
root_symlink = "database-character-sets")
if self.satellite:
self.add_copy_specs(["/etc/tnsnames.ora", "/etc/jabberd",
"/etc/tomcat6/", "/var/log/tomcat6/"])
if os.path.exists("/usr/bin/spacewalk-debug"):
self.add_cmd_output("/usr/bin/spacewalk-debug --dir %s"
% os.path.join(self.commons['dstroot'],
"sos_commands/rhn"))
if self.proxy:
self.add_copy_specs(["/etc/squid", "/var/log/squid"])
|