liveBook · Manning

Node.monitor/1

As explained in Elixir in Action, Third Edition

Node.monitor/2 is an Elixir function that monitors a particular remote node and reports its connection or disconnection.

Distributed nodes detect failed peers through periodic tick messages. Node.monitor/2 lets a process receive notifications when a particular remote node connects or disconnects, but does not reconnect it automatically. section 12.1.1 section 12.2.5

Choose the monitoring scope that matches the operational need:

  • Monitor one remote node with Node.monitor/2 when only a specific peer matters. section 12.2.5
  • Monitor all node connections and disconnections with :net_kernel.monitor_nodes/1. section 12.1.1 section 12.2.5
  • Treat remote-process monitoring separately: a crashed process or disconnected node produces a monitor message, whereas a link produces an exit signal. section 12.2.5

How Elixir in Action, Third Edition covers it

How deep it goes
Explains peer failure detection and monitoring scope, but defers implementation details and reconnection strategy.
Examples
Uses tick messages and nodeup or nodedown notifications to illustrate distributed-node availability changes.
What it assumes
Assumes distributed nodes and connections, while establishing tick-based failure detection and monitoring choices.
What you can do after
Apply Node.monitor/2 to receive targeted remote-node availability notifications.
How it connects
Connects remote node monitoring with :net_kernel.monitor_nodes/1, network partitions, process monitors, and links.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.