Skip to content

Instantly share code, notes, and snippets.

@mrmichalis
Created May 12, 2017 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmichalis/f3a2ef3119165e37dc04494d2cabf409 to your computer and use it in GitHub Desktop.
Save mrmichalis/f3a2ef3119165e37dc04494d2cabf409 to your computer and use it in GitHub Desktop.
Connect to Cloudera Manager Agent supervisord via xmlrpclib
#!/usr/lib64/cmf/agent/build/env/bin/python
# grep -A2 username /var/run/cloudera-scm-agent/supervisor/supervisord.conf | head -2
# ...
# username=6898309654436388381
# password=7733585661005351423
# ...
import xmlrpclib
server = xmlrpclib.Server('http://6898309654436388381:7733585661005351423@localhost:19001/RPC2')
server.system.listMethods()
# server.system.listMethods()
# ['supervisor.addProcessGroup', 'supervisor.clearAllProcessLogs', 'supervisor.clearLog',
# 'supervisor.clearProcessLog', 'supervisor.clearProcessLogs', 'supervisor.getAPIVersion',
# 'supervisor.getAllConfigInfo', 'supervisor.getAllProcessInfo', 'supervisor.getIdentification',
# 'supervisor.getPID', 'supervisor.getProcessInfo', 'supervisor.getState', 'supervisor.getSupervisorVersion',
# 'supervisor.getVersion', 'supervisor.readLog', 'supervisor.readMainLog', 'supervisor.readProcessLog',
# 'supervisor.readProcessStderrLog', 'supervisor.readProcessStdoutLog', 'supervisor.reloadConfig',
# 'supervisor.removeProcessGroup', 'supervisor.restart', 'supervisor.sendProcessStdin',
# 'supervisor.sendRemoteCommEvent', 'supervisor.shutdown', 'supervisor.startAllProcesses',
# 'supervisor.startProcess', 'supervisor.startProcessGroup', 'supervisor.stopAllProcesses',
# 'supervisor.stopProcess', 'supervisor.stopProcessGroup', 'supervisor.tailProcessLog',
# 'supervisor.tailProcessStderrLog', 'supervisor.tailProcessStdoutLog', 'system.listMethods',
# 'system.methodHelp', 'system.methodSignature', 'system.multicall']
server.supervisor.getAllProcessInfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment