<refentry id="repmgr-node-check">
  <indexterm>
    <primary>repmgr node check</primary>
  </indexterm>

  <refmeta>
    <refentrytitle>repmgr node check</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>repmgr node check</refname>
    <refpurpose>performs some health checks on a node from a replication perspective</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
      Performs some health checks on a node from a replication perspective.
      This command must be run on the local node.
    </para>
  </refsect1>

  <refsect1>
    <title>Example</title>
    <para>
      <programlisting>
       $ repmgr -f /etc/repmgr.conf node check
       Node "node1":
            Server role: OK (node is primary)
            Replication lag: OK (N/A - node is primary)
            WAL archiving: OK (0 pending files)
            Downstream servers: OK (2 of 2 downstream nodes attached)
            Replication slots: OK (node has no replication slots)</programlisting>
    </para>
  </refsect1>
  <refsect1>
    <title>Individual checks</title>
    <para>
      Each check can be performed individually by supplying
      an additional command line parameter, e.g.:
      <programlisting>
        $ repmgr node check --role
        OK (node is primary)</programlisting>
    </para>
    <para>
   Parameters for individual checks are as follows:
    <itemizedlist spacing="compact" mark="bullet">

     <listitem>
      <simpara>
        <literal>--role</literal>: checks if the node has the expected role
      </simpara>
     </listitem>

     <listitem>
      <simpara>
        <literal>--replication-lag</literal>: checks if the node is lagging by more than
        <varname>replication_lag_warning</varname> or <varname>replication_lag_critical</varname>
      </simpara>
     </listitem>

     <listitem>
      <simpara>
        <literal>--archive-ready</literal>: checks for WAL files which have not yet been archived
      </simpara>
     </listitem>

     <listitem>
      <simpara>
        <literal>--downstream</literal>: checks that the expected downstream nodes are attached
      </simpara>
     </listitem>

     <listitem>
      <simpara>
        <literal>--slots</literal>: checks there are no inactive replication slots
      </simpara>
     </listitem>

    </itemizedlist>
  </para>
  <para>
   Individual checks can also be output in a Nagios-compatible format by additionally
   providing the option <literal>--nagios</literal>.
  </para>
  </refsect1>
</refentry>
