summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-10-25 15:04:50 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-10-25 15:04:50 -0400
commit0a7afd78d699958283bb0adff8235ea9d1538280 (patch)
tree0aef63bc87c0476c7ad1aac9d8e94f85acf27ed5 /func
parent505165364f8acff6fb93329b4fc315a3e3427bcf (diff)
downloadthird_party-func-0a7afd78d699958283bb0adff8235ea9d1538280.tar.gz
third_party-func-0a7afd78d699958283bb0adff8235ea9d1538280.tar.xz
third_party-func-0a7afd78d699958283bb0adff8235ea9d1538280.zip
Adding part 2 to service inventory -- what the services are currently doing.
Diffstat (limited to 'func')
-rwxr-xr-xfunc/minion/modules/service.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/func/minion/modules/service.py b/func/minion/modules/service.py
index 9dcc422..3d3e4a9 100755
--- a/func/minion/modules/service.py
+++ b/func/minion/modules/service.py
@@ -65,6 +65,11 @@ class Service(func_module.FuncModule):
}
def get_enabled(self):
+ """
+ Get the list of services that are enabled at the various runlevels. Xinetd services
+ only provide whether or not they are running, not specific runlevel info.
+ """
+
chkconfig = sub_process.Popen(["/sbin/chkconfig", "--list"], stdout=sub_process.PIPE)
data = chkconfig.communicate()[0]
results = []
@@ -81,9 +86,17 @@ class Service(func_module.FuncModule):
return results
def get_running(self):
- return {
-
- }
+ """
+ Get a list of which services are running, stopped, or disabled.
+ """
+ chkconfig = sub_process.Popen(["/sbin/service", "--status-all"], stdout=sub_process.PIPE)
+ data = chkconfig.communicate()[0]
+ results = []
+ for line in data.split("\n"):
+ if line.find(" is ") != -1:
+ tokens = line.split()
+ results.append((tokens[0], tokens[-1].replace("...","")))
+ return results
methods = Service()
register_rpc = methods.register_rpc