Remote Admin¶
Getting started¶
Pypeman allow you to access remote instance two ways:
- With a python shell that give access to a client module.
- With a custom command shell
You need to add –remote-admin at pypeman startup to enable remote admin websocket.
Python shell¶
Python shell allow you to programatically administrate a remote pypeman instance through python command. You can start the python shell by executing:
pypeman pyshell
It starts a ipython instance with a RemoteAdminClient instance named client. The client instance API is:
-
class
pypeman.remoteadmin.RemoteAdminClient(loop=None, url='ws://localhost:8091') Remote admin client. To be use by ipython shell or pypeman shell.
Params url: Pypeman Websocket url. -
channels() Return a list of available channels on remote instance.
-
exec(command) Execute any valid python code on remote instance and return stdout result.
-
list_msg(channel, start=0, count=10, order_by='timestamp') List first 10 messages on specified channel from remote instance.
Params channel: The channel name. Params start: Start index of listing. Params count: Count from index. Params order_by: Message order. only ‘timestamp’ and ‘-timestamp’ handled for now. Returns: list of message with status.
-
push_msg(channel, text) Push a new message from text param to the channel.
Params channel: The channel name. Params text: This text will be the payload of the message.
-
replay_msg(channel, msg_ids) Replay specified message from id list of specified channel on remote instance.
Params channel: The channel name. Params msg_ids: Message id list to replay Returns: List of result for each message. Result can be {‘error’: <msg_error>} for one id if error occurs.
-
send_command(command, args=None) Send a command to remote instance
-
start(channel) Start the specified channel on remote instance.
Params channel: The channel name.
-
stop(channel) Stop the specified channel on remote instance.
Params channel: The channel name.
-
Custom command shell¶
The custom command shell has simple commands to ease administration for rapid tasks but with less possibility.
To launch remote shell, execute:
pypeman shell
You can show command help this way:
pypeman > help # For command list
pypeman > help <command name> # For help on a specific command