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
- Log in to Site24x7 and go to Server > Server Monitor > Servers (+) > Linux. You can also navigate via Admin > Inventory > Add Monitor > Linux Server Monitoring.
- 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=trueNoteRefer to our Knowledge Base document to understand more on the differences between root and non root installations.
- 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.
>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.
- 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 - 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
- [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 - [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="
NoteDevice 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:
- Download and save the file InstallSite24x7LinuxAgent.sh in your local machine.
- To create launch configuration :
For exampleas-create-launch-config <CONFIG_NAME> --image-id <AMI_ID> --instance-type <INSTANCE_TYPE> --user-data-file InstallSite24x7LinuxAgent.sh
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:
For exampleas-update-auto-scaling-group <GROUP_NAME> --launch-configuration <CONFIG_NAME>
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
NoteFor 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.
- Configure Linux agent using Chef
- Configure Linux agent using Puppet
- Configure Linux agent using Ansible
- Configure Linux agent using Saltstack
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.
-
On this page
- Connect to your EC2 instance
- Configure the Linux agent
- One step installation
- Alternative method to install Agent
- Installing the Linux agent while creating a new Amazon Machine Image AMI
- Linux agent installation via CloudFormation templates
- Agent installation during AutoScaling
- Installation via AWS Command Line Interface CLI
- Configuration management tools
- Uninstall the Linux agent