diff options
author | Michal Minar <miminar@redhat.com> | 2014-03-03 15:24:29 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2014-03-03 15:24:29 +0100 |
commit | 774789c3bffcbd2c9065e6b7c91d3bb32f02bdec (patch) | |
tree | c9329b70bdfe10b56f6477701dd43b4819728262 | |
parent | 6e33508670d086defdda906373c7dd50dbe595fd (diff) | |
parent | b06882c2941c5b028e84b96e8fbbda1d33cc690a (diff) | |
download | openlmi-scripts-774789c3bffcbd2c9065e6b7c91d3bb32f02bdec.tar.gz openlmi-scripts-774789c3bffcbd2c9065e6b7c91d3bb32f02bdec.tar.xz openlmi-scripts-774789c3bffcbd2c9065e6b7c91d3bb32f02bdec.zip |
Merge pull request #68 from pschiffe/master
System: added info about firewall and logging services
-rw-r--r-- | commands/system/README.md | 2 | ||||
-rw-r--r-- | commands/system/lmi/scripts/system/__init__.py | 35 | ||||
-rw-r--r-- | commands/system/setup.py | 2 |
3 files changed, 38 insertions, 1 deletions
diff --git a/commands/system/README.md b/commands/system/README.md index b80dfa4..728eb01 100644 --- a/commands/system/README.md +++ b/commands/system/README.md @@ -1,3 +1,5 @@ General system information available in OpenLMI providers. This command allows to list general information about system. + +Requires: openlmi-scripts-service diff --git a/commands/system/lmi/scripts/system/__init__.py b/commands/system/lmi/scripts/system/__init__.py index c3e6d3f..07529ad 100644 --- a/commands/system/lmi/scripts/system/__init__.py +++ b/commands/system/lmi/scripts/system/__init__.py @@ -32,6 +32,7 @@ LMI system client library. """ from lmi.scripts.common import get_computer_system +from lmi.scripts.service import get_service def _cache_replies(ns, class_name, method): """ @@ -107,6 +108,7 @@ def get_system_info(ns): result = get_hostname(ns) result += get_hwinfo(ns) result += get_osinfo(ns) + result += get_servicesinfo(ns) return result def get_hostname(ns): @@ -177,3 +179,36 @@ def get_osinfo(ns): ('OS:', os_str), ('Kernel:', kernel_str)] return result + +def get_servicesinfo(ns): + """ + :returns: Tabular data of some system services. + :rtype: List of tuples + """ + # Firewall + fw = '' + firewalld = get_service(ns, 'firewalld.service') + if firewalld and firewalld.Status == 'OK': + fw = 'on (firewalld)' + else: + iptables = get_service(ns, 'iptables.service') + if iptables and iptables.Status == 'OK': + fw = 'on (iptables)' + if not fw: + fw = 'off' + # Logging + logging = '' + journald = get_service(ns, 'systemd-journald.service') + if journald and journald.Status == 'OK': + logging = 'on (journald)' + else: + rsyslog = get_service(ns, 'rsyslog.service') + if rsyslog and rsyslog.Status == 'OK': + logging = 'on (rsyslog)' + if not logging: + logging = 'off' + # Result + result = [ + ('Firewall:', fw), + ('Logging:', logging)] + return result diff --git a/commands/system/setup.py b/commands/system/setup.py index 616a3e9..57b07a7 100644 --- a/commands/system/setup.py +++ b/commands/system/setup.py @@ -30,7 +30,7 @@ setup( 'Environment :: Console', ], - install_requires=['openlmi-scripts >= 0.2.7'], + install_requires=['openlmi-scripts >= 0.2.7', 'openlmi-scripts-service'], namespace_packages=['lmi', 'lmi.scripts'], packages=['lmi', 'lmi.scripts', 'lmi.scripts.system'], |