Help Docs

Linux agent installation

Installation

Connect to your EC2 instance

First connect to your Linux instance using SSH. Specify the path of the .pem file (the private key you create when you launch the instance), the user name and the public DNS name of the instance. The user name can be different for various flavours of Linux, check with your AMI provider, before you proceed.

For example:

ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

/path/my-key-pair .pem (path to the private key .pem file in your machine)

ec2-user (user name for the Linux instance)

ec2-198-51-100-1.compute-1.amazonaws.com  (public DNS for the instance)

Configure the Linux agent

Use the license key to authenticate the agent deployment. The agent will use this license key to associate the metrics gathered from the EC2 instance to your account. Know more.

One step installation

  1. Log in to Site24x7 and go to Server > Server Monitor > Servers (+) > Linux. You can also navigate via Admin Inventory Add Monitor > Linux Server Monitoring.
  2. Use the toggle button to install the agent as root or non root, and run the agent as root or non root after installation.
    For example, to install the agent as a root user, execute the following command:
    wget https://staticdownloads.site24x7.com/server/Site24x7InstallScript.sh
    bash Site24x7InstallScript.sh -i -key=<device key> -automation=true
    Note

    Refer to our Knowledge Base document to understand more on the differences between root and non root installations.

  3. Click on Copy to Clipboard to copy+paste the commands and execute them to download and install the Linux agent. The command given is independent of the OS architecture: 32-bit or 64-bit. 

Once the agent is installed, you can view the monitor under Server > Server Monitor > Servers.

Note

You can also associate Configuration Profiles including threshold, resource check, notification profiles during agent installation itself.

>Alternative method to install Agent

If you were unable to install the Linux server Monitoring Agent through the above methods, execute the following commands in the Linux terminal depending on whether the OS is 32-bit or 64-bit. Use the Device Key to authenticate the installation of the Linux agent.

  1. x86_64:
    sudo wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_64bit.install
    sudo chmod 755 Site24x7_Linux_64bit.install
    sudo ./Site24x7_Linux_64bit.install -i -key=<DEVICE_KEY> -automation=true

    To install the agent using organizational proxy:
    sudo wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_64bit.install
    sudo chmod 755 Site24x7_Linux_64bit.install 
    sudo ./Site24x7_Linux_64bit.install -i -key=<DEVICE_KEY> -automation=true -proxy=user:password@proxyhost:proxyport 
    or
    sudo ./Site24x7_Linux_64bit.install -i -key=<DEVICE_KEY> -automation=true -proxy=host:port
  2. x86_32:
    sudo wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_32bit.install
    sudo chmod 755 Site24x7_Linux_32bit.install
    sudo ./Site24x7_Linux_32bit.install -i -key=<DEVICE_KEY> -automation=true

    To install the agent using organizational proxy:
    sudo wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_32bit.install
    sudo chmod 755 Site24x7_Linux_32bit.install 
    sudo ./Site24x7_Linux_32bit.install -i -key=<DEVICE_KEY> -automation=true -proxy=user:password@proxyhost:proxyport
    or
    sudo ./Site24x7_Linux_32bit.install -i -key=<DEVICE_KEY> -automation=true -proxy=host:port

Installing the Linux agent while creating a new Amazon Machine Image (AMI)

You can add the below given agent installation script to the /etc/rc.local file on your Linux EC2 instance. Once done, the script will be executed at boot time and the Linux agent will be dowloaded and installed on your instance.

Append the device key to the below script and add it to the /etc/rc.local file

  1. [64-bit:AMI]
    if [ ! -f /opt/site24x7/monagent/ ]; then
    wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_64bit.install
    chmod 755 Site24x7_Linux_64bit.install
    ./Site24x7_Linux_64bit.install -i -automation=true -key=<DEVICE_KEY>
    fi
  2. [32-bit:AMI]
    if [ ! -f /opt/site24x7/monagent/ ]; then
    wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_32bit.install
    chmod 755 Site24x7_Linux_32bit.install
    ./Site24x7_Linux_32bit.install -i -automation=true -key=<DEVICE_KEY>
    fi

Linux agent installation via CloudFormation templates

Using the Cloud Formation template you can automatically configure the Linux agent without connecting to the instance

Add the following commands to the user data property in the CloudFormation scripts. The user data property runs the necessary actions to install the Linux agent at the launch of the template.

  • "UserData" :{ 
    "Fn::Base64" : {
    "Fn::Join" : [ ",", [
    "#!/bin/bash\n",
    "sudo wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_64bit.install",
    "sudo chmod 755 Site24x7_Linux_64bit.install\n",
    "sudo ./Site24x7_Linux_64bit.install -i -automation=true -key=<DEVICE_KEY>\n"]]
    }
    }

Agent installation during AutoScaling

Create an AutoScaling launch configuration template and assign it to the AutoScaling group. This template will be used to launch EC2 instances. The launch configuration template will contain information about the EC2 instance - ID of the instance AMI, instance type, security group, etc. This is the same information you provide when you launch an EC2 instance, here again you have the option of passing the Linux agent shell script as user data.

Download our Linux agent shell script "InstallSite24x7LinuxAgent.sh", append the Device key and pass it as user data to run the script when the instance starts.

  • Download and save the file InstallSite24x7LinuxAgent.sh in your local machine.
  • Edit the script file to include your DEVICE Key in DEVICE_KEY="
    Note

    Device key can be obtained from Admin > Developer > Device Key. 

  • Login into your AWS account and navigate to the EC2 management console
  • In the navigation pane under Auto Scaling select “Launch configuration” and click on “Create launch configuration”.
  • Under the “Choose AMI tab”, select the AMI you want to use, under the “Configure details” tab, select advanced details to expand the section
  • Select the “As file” option in the “User data” field. Browse and upload the InstallSite24x7LinuxAgent.sh file that is saved in your local disk.
  • Now review and launch the newly created configuration, once done you can apply the launch configuration to your AutoScaling group.

You can also create and assign an launch configuration to a group using the AWS CLI (Command line interface)

The following steps will help you install agent during AWS Autoscaling:

  • To create launch configuration :
    as-create-launch-config <CONFIG_NAME> --image-id <AMI_ID> --instance-type <INSTANCE_TYPE> --user-data-file InstallSite24x7LinuxAgent.sh
    For example
    as-create-launch-config TestLaunchConfig --image-id ami-bd4ed56f --instance-type t1.micro --user-data-file InstallSite24x7LinuxAgent.sh
  • To assign the configuration to an Autoscaling group:
    as-update-auto-scaling-group <GROUP_NAME> --launch-configuration <CONFIG_NAME>
    For example
    as-update-auto-scaling-group TestAutoScalingGroup --launch-configuration TestLaunchConfig
  • Scaling down in AWS:

    If an integrated EC2 instance is stopped/terminated by an autoscaling group, both the EC2 instance and the server agent won't alert it as Down.

Installation via AWS Command Line Interface (CLI)

If you have already set up and installed the AWS command line interface in your machine, then you can:

  • Download and save the file InstallSite24x7LinuxAgent.sh in your machine.
  • Edit the script file to include your DEVICE Key in DEVICE_KEY="
  • Run the following command in your CLI
    ec2-run-instances --key KEYPAIR --user-data-file InstallSite24x7LinuxAgent.sh ami-bf5eb9d6
    Note

    For instructions on how to install AWS CLI refer here.

Configuration management tools

You can also use configuration management tools like Chef to bulk install the Linux agent on your EC2 instance.

Restart the Agent

Execute the below commands based on the user type:

Root user:

sudo /opt/site24x7/monagent/bin/monagent restart

Non root user:

<home_dir_of_user_who_installed_the_agent>/site24x7/monagent/bin/monagent restart 

Uninstall the Linux agent

Execute the below commands based on the user type:

Root user:

sudo /opt/site24x7/monagent/bin/uninstall

Non root user:

<home_dir_of_user_who_installed_the_agent>/site24x7/monagent/bin/uninstall

Execute our out-of-the box Linux plugins

Monitor critical metrics for various application services running in your AWS stack. Execute our out-of-the box plugins to monitor the performance of Apache, NGINX, MySQL, Memcached and 30 other application services, running on your Linux EC2 instance.

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.


We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.


Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!