Added detection check to find process by service command.
Modified RabbitMQ plugin to search for epmd process rather than rabbitmq-server wrapper script which has been removed as of version 3.6.2 Change-Id: I54921ea52cd4d1dc458a4fda237858169f6afc0e
This commit is contained in:
parent
0087a9491f
commit
e4ca14fc1a
@ -1,4 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/monasca-agent.git
|
||||
project=openstack/monasca-agent.git
|
||||
|
@ -48,7 +48,7 @@ class RabbitMQ(monasca_setup.detection.Plugin):
|
||||
def _detect(self):
|
||||
"""Run detection, set self.available True if the service is detected.
|
||||
"""
|
||||
if monasca_setup.detection.find_process_cmdline('rabbitmq-server') is not None:
|
||||
if monasca_setup.detection.find_process_service('rabbitmq-server') is not None:
|
||||
self.available = True
|
||||
|
||||
def _get_config(self):
|
||||
@ -129,7 +129,7 @@ class RabbitMQ(monasca_setup.detection.Plugin):
|
||||
"""
|
||||
config = monasca_setup.agent_config.Plugins()
|
||||
# First watch the process
|
||||
config.merge(monasca_setup.detection.watch_process(['rabbitmq-server'], 'rabbitmq', detailed=False))
|
||||
config.merge(monasca_setup.detection.watch_process(['epmd'], 'rabbitmq', detailed=False))
|
||||
log.info("\tWatching the rabbitmq-server process.")
|
||||
config.merge(monasca_setup.detection.watch_process_by_username('rabbitmq', 'rabbitmq', 'rabbitmq'))
|
||||
log.info("\tWatching all processes owned by the rabbitmq user.")
|
||||
|
@ -60,6 +60,18 @@ def find_process_name(pname):
|
||||
return None
|
||||
|
||||
|
||||
def find_process_service(sname):
|
||||
"""Simple function to call systemctl (service) to check if a service is running.
|
||||
"""
|
||||
try:
|
||||
subprocess.check_call(['service', sname, 'status'], stdout=PIPE, stderr=PIPE)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def find_addr_listening_on_port(port):
|
||||
"""Return the IP address which is listening on the specified TCP port."""
|
||||
for conn in psutil.net_connections(kind='tcp'):
|
||||
|
Loading…
Reference in New Issue
Block a user