.. _neteye-command:

The ``neteye`` Command
======================

The :command:`neteye` CLI command is used from the CLI to carry out a
few tasks related to the NetEye Installations, both Single Nodes and
Cluster. Various sub-commands are available and are analysed in this
section:

.. _neteye-status:

``neteye status``
-----------------

:command:`neteye status` is used to list the NetEye services and their
status, either **UP** or **DOWN**.

.. _neteye-start:
.. _neteye-stop:

``neteye start | stop``
-----------------------

The :command:`neteye start` and :command:`neteye stop` command are
used to start or stop all NetEye services at once.

.. _neteye-update:

``neteye update``
-----------------

The :command:`neteye update` command runs a number of tasks as
listed below in order of execution.

.. csv-table::
   :header: "Task", "Order", "Single Node", "Cluster", "Description"
   :widths: 25, 10, 10, 10, 55

   "Health checks", "#1", "yes", "yes", "Carry out health checks to verify
   that NetEye installation is healthy and eligible for update"
   "Standby and fencing", "#2", "no", "yes", "puts all nodes in standby
   except the Elected Master, and disables fencing, if enabled"
   "Update RPM", "#3", "yes", "yes", "Installs all RPM updates (bugfixes)
   for the current version"
   "``.rpmsave`` and ``.rpmnew`` check", "#4", "yes", "yes", "Searches for
   any ``.rpmsave`` and ``.rpmnew`` files"
   "Secure install", "#5", "yes", "yes",  "Execute ``neteye_secure_install``
   to complete update and initialise all NetEye modules"

If any of these tasks is unsuccessful, a message will explain where
the command failed, allowing you to manually fix the corresponding
step, then launch again the :command:`neteye update` command. Check
also the :ref:`update-ts` section for more information and directions
about fixing the problems.

.. _neteye-upgrade:

``neteye upgrade``
------------------

.. warning:: It is not possible to use the command :command:`neteye upgrade`
   to upgrade NetEye from version **4.22** to **4.23**. Instead, use the
   command :command:`neteye node system-upgrade` as described in the upgrade
   procedure.

The :command:`neteye upgrade` is called after :command:`neteye update`
and carries out a number of tasks that differ when it is executed on a
Single Node or on a Cluster node.

.. warning:: The :command:`neteye upgrade` command may take a long time
   before it completes successfully, so please do not interrupt it
   until it exits.

The tasks carried out by the :command:`neteye upgrade` command are
listed below in order of execution. It is also mentioned if they run
on Clusters or Single Nodes.

.. rubric:: Single Nodes and Cluster

.. csv-table::
   :header: "Task", "Order", "Single Node", "Cluster", "Description"
   :widths: 25, 10, 10, 10, 55

   "Health checks", "#1", "yes", "yes", "Carry out health checks to verify
   that NetEye installation is healthy and eligible for update"
   "Check update status", "#2", "yes", "yes", "NetEye is fully updated and
   there are no minor (bugfix) updates to be installed, otherwise it
   will install the available updates"
   "Upgrade eligibility", "#3", "yes", "yes",  "Verify that NetEye is
   eligible for upgrade: it checks which is the installed version
   (e.g., **4.20**) and that the last upgrade :ref:`was finalized
   <neteye_scripts>`"
   "Standby and fencing", "#4", "no", "yes", "puts all nodes in standby
   except the Elected Master, and disables fencing, if enabled"
   "Master node check", "#5", "no", "yes", "Make sure the *Master Node*
   is **active** (i.e. non in standby mode, please refer to section
   :ref:`ne-elected-master` below to understand which node is
   considered as the Master Node."
   "Repo update", "#6", "yes", "yes", "Update all the NetEye repositories to
   the next version to which it is possible to upgrade (e.g.,
   **4.21**)"
   "Packages check", "#7", "yes", "yes", "Check for new software packages in
   the repositories"
   "Package install", "#8", "yes", "yes", "Install new
   packages"
   "Yum groups install", "#9", "yes", "yes", "Install new packages that
   belong to the NetEye yum groups"
   "``.rpmsave`` and ``.rpmnew`` check", "#10", "yes", "yes", "Searches for
   any ``.rpmsave`` and ``.rpmnew`` files"
   "Finalise installation", "#11", "yes", "yes", "The
   ``neteye_secure_install`` and ``neteye_finalize_installation``
   scripts are executed"

If the :command:`neteye upgrade` command is successful, a message will
inform you that the upgrade procedure concludes
successfully. Otherwise, if the commands breaks at some point, you
need to fix the failed tasks manually and then launch again the
command. Check
also the :ref:`update-ts` section for more information and directions
about fixing the problems.

What ``neteye update`` and ``neteye upgrade`` do *not* do on Clusters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following tasks are required to bring a cluster back to the
correct operative status after an update or an upgrade and need
to be carried out manually:

* `Unstandby` nodes
* Restore `stonith` on cluster

Additionally, the commands **can not be launched** on `Elastic-only` or a
`Voting-only` nodes. Please note that, however, even if the two commands
can be executed on operative nodes only, the update/upgrade procedure **is
performed** also on `Elastic-only` and `Voting-only` nodes.

``neteye update`` vs. ``neteye upgrade``
----------------------------------------

The main difference between the two commands is that the
:command:`neteye update` installs all available packages in the
**current** version of NetEye. On the other side, :command:`neteye
upgrade` installs all available packages in **next** version of
NetEye.

For example, given a NetEye version **4.20**, :command:`neteye update`
fully updates NetEye 4.20 with the latest packages in the **4.20
repository**, while :command:`neteye upgrade` installs and configures
all new packages available in the **4.21** repository.

.. _neteye-node:

``neteye node``
---------------

The command :command:`neteye node` is responsible for performing operations on
the node on which it is executed such as updating the operating system.
The only sub-command available is `system-upgrade`.

.. _neteye-node-system-upgrade:

``neteye node system-upgrade``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The command :command:`neteye node system-upgrade` executed on a specific node is
responsible for the upgrade of NetEye from version **4.22** to **4.23** and also
of the upgrade of the operating system from CentOS 7 to RHEL 8.

As described in the upgrade procedure it will upgrade the operating system from
NetEye 4.22 on CentOS 7 to RHEL 7 and then to RHEL 8 with NetEye 4.23.
After each change of operating system, a reboot is required.
In the case of a cluster, the command must be executed node by node and before
starting with a new node, the previous one must have finished the upgrade to RHEL 8.

.. _neteye_scripts:

Supporting Scripts
------------------

Two scripts complement the abilities of the :command:`neteye update`
and :command:`neteye upgrade` commands:

For more details, refer to the next two sections.

.. _neteye-secure-install:

``neteye_secure_install``
~~~~~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/neteye-secure-install.rst

.. _finalize-neteye-upgrade:

``neteye_finalize_installation``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/finalize-neteye-upgrade.rst


.. _ne-elected-master:

The Elected NetEye Master
-------------------------

.. include:: /includes/elected-neteye-master.rst
