Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

To start using Longview to capture metrics from a Linux server, you need to create a new Longview Client instance and install the Longview Agent on that server.

  1. Create a Longview Client
  2. SSH into the Compute Instance
  3. Install the Longview Agent
  4. Start the Longview Agent
  5. View Longview Client Statistics

Create a Longview Client

  1. Log in to the Cloud Manager and click on the Longview link in the sidebar.

  2. On the Longview Clients page, click on the Add a Client link on the top right-hand corner. This creates a Longview Client instance.

  3. The new Longview Client instance is displayed along with its auto-generated label, its current status, installation instructions, and API key. Its status should be “Waiting for data” as you have not yet installed the Longview agent on your Linux system.

    Note
    The displayed curl command is used in the next section to install the Longview agent on the desired Linux system. The long string appended to the url https://lv.linode.com/ is your Longview Client instance’s GUID (globally unique identifier).

SSH into the Compute Instance

  1. Open a terminal on your local computer and log in to your Compute Instance (or other Linux system) over SSH. In the command below, replace [user] with your remote username and [ip-address] with the IP address or fully qualified domain name of your instance. See Managing IP Addresses on a Compute Instance.

    ssh [user]@[ip-address]
  2. Switch to the root user.

    su - root

Install the Longview Agent

Automatic Installation

Run the Longview Client instance’s curl command on your Linux system. The installation will take a few minutes to complete.

Note
Ensure you replace the example curl command below with your own Longview Client instance’s GUID.
curl -s https://lv.linode.com/05AC7F6F-3B10-4039-9DEE09B0CC382A3D | sudo bash
  • Lock error: This likely means that another program is attempting to update or install packages on your system. To overcome this error, you can delete the current Longview Client, wait a few minutes, create a new Longview Client, and try the installation process again.

    E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 12549 (apt-get)
    N: Be aware that removing the lock file is not a solution and may break your system.
    E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
  • Invaliad installer session error: To overcome this error, delete the current Longview Client, create a new one, and try to install the Longview Agent again.

    Invalid Installer Session
    Please see the Longview details page to start a new session

If you are not able to overcome these error messages, follow the manual installation instructions below.

Manual Installation

If the automatic installation instructions failed, you can also manually install the Longview Agent on CentOS, Debian, and Ubuntu. Other distributions, like Fedora and Alpine Linux, are not officially supported.

  1. Add a configuration file to store the repository information for the Longview agent:

    Find the codename of the distribution running on your Linode.

    root@localhost:~# lsb_release -sc
    stretch

    Using the text editor of your choice, like nano, create a custom sources file that includes Longview’s Debian repository and the Debian distribution codename. In the command below, replace stretch with the output of the previous step.

    File: /etc/apt/sources.list.d/longview.list
    1
    
    deb http://apt-longview.linode.com/ stretch main

    Using the text editor of your choice, like nano, create a .repo file and copy the contents of the example file below. Replace REV in the repository URL with your CentOS version (e.g., 7). If unsure, you can find your CentOS version number with cat /etc/redhat-release.

    File: /etc/yum.repos.d/longview.repo
    1
    2
    3
    4
    5
    
    [longview]
    name=Longview Repo
    baseurl=https://yum-longview.linode.com/centos/REV/noarch/
    enabled=1
    gpgcheck=1
  2. Download the repository’s GPG key and import or move it to the correct location:

    sudo curl -O https://apt-longview.linode.com/linode.gpg
    sudo mv linode.gpg /etc/apt/trusted.gpg.d/linode.gpg
    sudo curl -O https://yum-longview.linode.com/linode.key
    sudo rpm --import linode.key
  3. Create a directory for the API key:

    sudo mkdir /etc/linode/
  4. Copy the API key from the Installation tab of your Longview client’s detailed view in the Linode Cloud Manager. Put the key into a file, replacing the key in the command below with your own.

    echo '266096EE-CDBA-0EBB-23D067749E27B9ED' | sudo tee /etc/linode/longview.key
  5. Install Longview:

    sudo apt update
    sudo apt install linode-longview
    sudo yum install linode-longview

Start the Longview Agent

Once the installation is complete, verify that the Longview agent is running:

sudo systemctl status longview

You should see a similar output:

● longview.service - LSB: Longview Monitoring Agent
Loaded: loaded (/etc/init.d/longview; generated; vendor preset: enabled)
Active: active (running) since Mon 2019-12-09 21:55:39 UTC; 2s ago
    Docs: man:systemd-sysv-generator(8)
Process: 2997 ExecStart=/etc/init.d/longview start (code=exited, status=0/SUCCESS)
    Tasks: 1 (limit: 4915)
CGroup: /system.slice/longview.service
        └─3001 linode-longview
● longview.service - SYSV: Longview statistics gathering
  Loaded: loaded (/etc/rc.d/init.d/longview; bad; vendor preset: disabled)
  Active: active (running) since Tue 2019-12-10 22:35:11 UTC; 40s ago
    Docs: man:systemd-sysv-generator(8)
  CGroup: /system.slice/longview.service
          └─12202 linode-longview

Dec 10 22:35:11 203-0-113-0.ip.linodeusercontent.com systemd[1]: Starting SYSV: Longview statistics gathering...
Dec 10 22:35:11 203-0-113-0.ip.linodeusercontent.com longview[12198]: Starting longview: [  OK  ]
Dec 10 22:35:11 203-0-113-0.ip.linodeusercontent.com systemd[1]: Started SYSV: Longview statistics gathering.

If the Longview agent is not running, start it with the following command:

sudo systemctl start longview

View Longview Client Statistics

Switch back to the Cloud Manager’s Longview Clients page in your browser and verify that system information and metrics have started to appear. To learn more about the metrics available on Longview, see Understanding Longview Metrics.

Note
It can take several minutes for data to load and display in the Cloud Manager.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.