Skip to content

Commit

Permalink
[JMX AD] Wraps the jmx_state get call in try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
vagrant authored and Nicholas Muesch committed Jul 31, 2017
1 parent 6c96bdd commit 4d1f7b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,13 @@ def _submit_jmx_service_discovery(self, jmx_sd_configs):
return

if self.supervisor_proxy is not None:
jmx_state = self.supervisor_proxy.supervisor.getProcessInfo(JMX_SUPERVISOR_ENTRY)
log.debug("Current JMX check state: %s", jmx_state['statename'])
try:
jmx_state = self.supervisor_proxy.supervisor.getProcessInfo(JMX_SUPERVISOR_ENTRY)
log.debug("Current JMX check state: %s", jmx_state['statename'])
except Exception as e:
log.exception("Cannot submit JMX autodiscovery configurations. Unable to get JMXFetch process state from supervisor: %s", e)
return

# restart jmx if stopped
if jmx_state['statename'] in ['STOPPED', 'EXITED', 'FATAL'] and self._agentConfig.get('sd_jmx_enable'):
self.supervisor_proxy.supervisor.startProcess(JMX_SUPERVISOR_ENTRY)
Expand Down

0 comments on commit 4d1f7b0

Please sign in to comment.