Video guidevideo 5:04

    Video guide: Fleet agents – how they work, install and uninstall

    Video and step-by-step guide to Fleet agents in FlowPro NG, how they work, one-command installation, device registration, policy change and uninstall.

    By FlowPro team

    Contents

    A Fleet agent sends logs and metrics from servers and computers to FlowPro NG. The video shows the whole procedure: how the agent works, how to install it with one command, what to do with it in FlowPro NG and how to uninstall it again. It takes five minutes. Below you will find the same procedure as a step-by-step guide, including commands to copy.

    What you will need

    • an administrator account in FlowPro NG (only an administrator can generate the install command),
    • root or sudo access on the server (Linux, macOS), or an administrator account on Windows,
    • a free path from the server to FlowPro NG on ports TCP 443, 8220 and 9200.

    In the example, FlowPro NG opens at flowpro.firma.cz and the monitored server is called web01. Replace them with yours.

    How a Fleet agent works

    A Fleet agent is a program that runs directly on a server or a computer. It is the Elastic Agent, managed centrally by FlowPro NG. It collects system logs and metrics (CPU, memory, disk, network) and sends them to FlowPro NG. It runs on Linux, Windows and macOS.

    The agent connects to FlowPro NG by itself, outbound only. No port is opened on the monitored server. Each of the three ports has its purpose:

    • TCP 443 – the install script and the agent download,
    • TCP 8220 – agent management (Fleet Server),
    • TCP 9200 – sending data.

    The agent does not need internet access; everything is downloaded from your FlowPro NG.

    What the agent collects is decided by its policy. It gets one according to the role of the server:

    • general server – system logs and metrics,
    • web server – also Nginx and Apache logs,
    • mail server – also Postfix and Dovecot logs.

    In the licence, every device counts as one agent.

    1. Open Add Fleet Agent

    In FlowPro NG open Infrastructure → Fleet Agents and click Add Fleet Agent.

    Infrastructure, the Fleet Agents tab with the Add Fleet Agent button
    Infrastructure, the Fleet Agents tab with the Add Fleet Agent button

    2. Choose the system and copy the command

    Choose the operating system in the window:

    • Linux – run the command in the terminal as root, or with sudo,
    • Windows – run the command in PowerShell as administrator,
    • macOS – run the command in the Terminal app.

    Copy the command with the Copy button. It contains a token valid for one hour; when it expires, generate a new one.

    The Add Fleet Agent window: system choice, install command and token validity
    The Add Fleet Agent window: system choice, install command and token validity

    Further down, the window shows what the command does and which ports it needs. Ticking Also install FlowPro agent installs, together with the Fleet agent, the agent that can make changes on the server.

    What the command does and which ports must be reachable from the server to FlowPro NG
    What the command does and which ports must be reachable from the server to FlowPro NG

    3. Run the command on the server

    Paste the command into the terminal of the server. The installer checks the system and asks for the role of the server. It recognises a running web or mail server by itself and preselects the right role. If it finds PostgreSQL or MySQL / MariaDB on the server, it also offers to monitor the database.

    Installer: choice of the server role, web server preselected
    Installer: choice of the server role, web server preselected

    After you confirm the summary, the installer verifies the connection to FlowPro NG, downloads the agent, checks its checksum, installs it and enrolls it in Fleet. It takes about half a minute.

    Installer: installation complete and useful commands
    Installer: installation complete and useful commands

    The agent then runs as a system service and starts after every reboot. This command shows its state:

    sudo elastic-agent status

    Both items should be HEALTHY.

    Output of elastic-agent status: Connected and Running
    Output of elastic-agent status: Connected and Running

    Installation without questions

    For automation, for example with Ansible, the install script can run without questions. Add these parameters to the end of the command from FlowPro NG, after bash /tmp/flowpro-install.sh:

    --role web --with postgresql --yes

    The role is general, web or mail; --with turns on database monitoring.

    4. Check the connection

    The window you copied the command from shows by itself that the server has connected and that data is arriving. If the data did not arrive, it tells you which port to allow.

    Connection check: the server web01 is online and data is arriving
    Connection check: the server web01 is online and data is arriving

    5. Register the device

    The server appears in the list of Fleet agents with its status, role, number of events and load. It is not registered yet, which is why it shows the Register link.

    List of Fleet agents: the new server web01 with the Register link
    List of Fleet agents: the new server web01 with the Register link

    Click it, fill in the name, site and importance of the device and confirm with Register.

    The Register Device window: name, site and importance
    The Register Device window: name, site and importance

    The device gets its own detail page with metrics, charts and events. The Agents tab shows who sends data about the device, what state it is in and what exactly it delivers.

    Device detail, the Agents tab: the Fleet agent and an overview of who delivers what
    Device detail, the Agents tab: the Fleet agent and an overview of who delivers what

    6. Agent actions and changing the policy

    Every agent in the list has a menu of actions (the three dots at the end of the row):

    • Change Policy – changes the role of the server,
    • Upgrade Agent – moves the agent to a newer version; active only when a newer version is available,
    • Unenroll from Fleet – the agent stops sending data and frees its place in the licence.

    The same actions can be run in bulk: tick several agents and choose the action above the table.

    Agent actions menu: Change Policy, Upgrade Agent, Unenroll from Fleet
    Agent actions menu: Change Policy, Upgrade Agent, Unenroll from Fleet

    To change the policy, pick the new role from the list. The change applies within a minute and nothing is reinstalled. An overview of all policies and what they collect is in Settings → Agent Policy.

    The Change Policy window with the list of policies
    The Change Policy window with the list of policies

    Uninstalling the agent

    1. Copy the command

    In the Add Fleet Agent window, expand the Uninstall the Agent section at the bottom and copy the command for the selected system.

    The Uninstall the Agent section with the command for Linux
    The Uninstall the Agent section with the command for Linux

    2. Run it on the server

    On Linux and macOS:

    sudo elastic-agent uninstall -f

    On Windows, in PowerShell run as administrator:

    & 'C:\Program Files\Elastic\Agent\elastic-agent.exe' uninstall -f

    The agent stops and is removed together with its service.

    Terminal: Elastic Agent has been uninstalled
    Terminal: Elastic Agent has been uninstalled

    3. Unenroll the agent from Fleet

    In FlowPro NG the agent goes offline after a few minutes. Choose Unenroll from Fleet in the actions menu and confirm. The agent no longer takes a place in the licence and disappears from the list.

    Confirmation of unenrolling the agent from Fleet
    Confirmation of unenrolling the agent from Fleet

    The device and the data collected from it stay in the register. If you no longer need it, open the Devices list and choose Remove from register in the actions menu.

    The agent did not connect?

    Check four things:

    1. Ports TCP 443, 8220 and 9200 are reachable from the server to FlowPro NG.
    2. The token in the command is still valid (one hour). If not, generate a new command.
    3. The agent is online but no data arrives: in FlowPro NG allow port 9200 from the address of the server in Settings → Firewall. No reinstall is needed.
    4. On the server, elastic-agent status shows HEALTHY. Details are in the log: sudo journalctl -u elastic-agent -f.
    • Video
    • Fleet agent
    • Infrastruktura
    • Instalace

    Try it on your own network

    The 14-day Enterprise trial unlocks every module. You install it on your own server, no credit card needed.