Create a gist now

Instantly share code, notes, and snippets.

@pnc /observer.md
Last active May 17, 2018

Embed
What would you like to do?
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host

On your machine, start a hidden Erlang node running the observer app:

$ erl -name debug@127.0.0.1 -setcookie if-server-has-one -hidden -run observer

N.B.: If the server is using -sname, you need to use -sname as well, because Erlang™. You'll also need to change your system's hostname to match the target host, for the same reason.

In observer, go to Nodes - Connect Node and type some_node@127.0.0.1.

You can also get a remote shell:

$ erl -name debug@127.0.0.1 -setcookie if-server-has-one -remsh some_node@127.0.0.1
@fogfish

This comment has been minimized.

Show comment
Hide comment
@fogfish

fogfish Jun 22, 2015

This technique works if some_node is bound to local interface on remote-host. Any idea how to use ssh tunnelling to connect remote node if it bound to other interface (e.g. eth0)?

fogfish commented Jun 22, 2015

This technique works if some_node is bound to local interface on remote-host. Any idea how to use ssh tunnelling to connect remote node if it bound to other interface (e.g. eth0)?

@freshvolk

This comment has been minimized.

Show comment
Hide comment
@freshvolk

freshvolk Aug 29, 2015

Think you have to make sure GatewayPorts set to yes in the remote's /etc/ssh/sshd_config, then find out the address for the other interface so it looks like:
ssh -L 4369:other_interface:4369 -L 58769:other_interface:58769 remote-host

But that's only if you specifically bound the node to the other interface. You may only have bound your application to the other interface.

Think you have to make sure GatewayPorts set to yes in the remote's /etc/ssh/sshd_config, then find out the address for the other interface so it looks like:
ssh -L 4369:other_interface:4369 -L 58769:other_interface:58769 remote-host

But that's only if you specifically bound the node to the other interface. You may only have bound your application to the other interface.

@flupke

This comment has been minimized.

Show comment
Hide comment
@flupke

flupke Mar 22, 2016

Note: if you want to observe an exrm packaged app, you have to include :runtime_tools in your applications list.

flupke commented Mar 22, 2016

Note: if you want to observe an exrm packaged app, you have to include :runtime_tools in your applications list.

@cdegroot

This comment has been minimized.

Show comment
Hide comment
@cdegroot

cdegroot Aug 8, 2016

For the lazy ones:

slogin -v $ERL_HOST $(slogin $ERL_HOST "epmd -names"|grep -wo '[0-9][0-9]*'|sed 's/.*/-L&:localhost:&/')

should get you port forwards to everything that's running on the remote host.

cdegroot commented Aug 8, 2016

For the lazy ones:

slogin -v $ERL_HOST $(slogin $ERL_HOST "epmd -names"|grep -wo '[0-9][0-9]*'|sed 's/.*/-L&:localhost:&/')

should get you port forwards to everything that's running on the remote host.

@sgeos

This comment has been minimized.

Show comment
Hide comment
@Stratus3D

This comment has been minimized.

Show comment
Hide comment
@Stratus3D

Stratus3D Feb 17, 2017

Just threw together a shell script that automatically forwards the necessary ports: https://github.com/Stratus3D/dotfiles/blob/master/scripts/tools/epmd_port_forwarder

Give it the server hostname and it does the rest.

./scripts/tools/epmd_port_forwarder --server=server_fqdn

Just threw together a shell script that automatically forwards the necessary ports: https://github.com/Stratus3D/dotfiles/blob/master/scripts/tools/epmd_port_forwarder

Give it the server hostname and it does the rest.

./scripts/tools/epmd_port_forwarder --server=server_fqdn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment