-
Notifications
You must be signed in to change notification settings - Fork 7
Cheatsheet
Smith has three main components: the agency, agents and smithctl. The agency is used to manage running agents but can be restart without impacting the agents (unless an agent dies while the agency is down. The agents are the bits that do the actual work and smithctl is a command line tool that is used to control agents.
For when you have to kill 'em all. My naive approach:
smithctl list -la | awk -F ' ' '{print $2}' | xargs smithctl kill $1
To find out the list of commands you can run smithctl commands, smithctl commands -l will give some details on what the command does.
For convenience here are some often used commands:
To list agents
smithctl list will list the uuids of all running agents.
smithctl list -l will list details of all running agents in the running state.
smithctl list -la will list details of all agents in any state (starting, stopping, dead, etc).
To change the log level and any agent.
smithctl logger -l warn <uuid> change the log level of the specified agent.
smithctl logger -l warn $(smithctl list) change the log level of all agents.
smithctl logger -l warn $(smithctl list <agent name>) change the log level of all instances of the named agent.
To look at a message[s] or remove a message[s] from a queue.
smithctl pop -jp <queue name> look at a single message in json format.
smithctl pop -n 20 -jp <queue name> look at a 20 messages in json format.
smithctl pop -r <queue name> remove a single message.
smithctl pop -r -n 20 <queue name> remove 20 messages.
smithctl pop -prj -n 20 <queue name> remove 20 messages and print them in json format.
To push a message onto a queue
smithctl push -t <type> -m <single line json>
For example:
smithctl push -t Smith::ACL::Customer -m '{"foo":"bar"}' xplatform.customer.match
you can also pipe a file into smithctl push with a message per line in JSON format.
cat <file> | smithctl push -t Smith::ACL::Customer xplatform.customer.match
To stop & start a group of agent
smithctl stop -g <agent name> will stop all agents
smithctl start -g <agent name> will start all agents
smithctl list -la will show you all the agents, so compare the number of agents to check whether all agents are started.