Working with the Linux agent
After you provision an instance of the IBM Cloud Monitoring service in the IBM Cloud, you can deploy the Monitoring agent on your Linux hosts to collect data and metrics automatically. You can configure which metrics to monitor in each environment.
You can associate one or more tags to each monitoring agent. Tags are comma-separated values that are formatted as TAG_NAME:TAG_VALUE. When you monitor your environment, you can use these tags to identify metrics that are available from an agent. For example, you can include information about the service name and location with all of the metrics that are collected by this agent.
Prereqs
Check the topic Tune Agent
Deploying the Linux agent by using a script
Complete the following steps to configure a monitoring agent on Linux to collect and forward metrics to an instance of the IBM Cloud Monitoring service:
-
Obtain the public or private ingestion URL. For more information, see collector endpoints.
-
Install the kernel headers.
When you install a monitoring agent, the agent uses kernel header files. Learn more
Choose a distribution and run the following command for that distribution.
For Debian and Ubuntu Linux distributions, run the following command:
apt-get -y install linux-headers-$(uname -r)
For RHEL, CentOS, and Fedora Linux distributions, run the following command:
yum -y install kernel-devel-$(uname -r)
-
Deploy the monitoring agent. Run the following command from a terminal.
curl -sL https://ibm.biz/install-sysdig-agent | sudo bash -s -- --access_key MONITORING_ACCESS_KEY --collector COLLECTOR_ENDPOINT --collector_port 6443 --tags TAG_DATA --additional_conf 'sysdig_capture_enabled: false\nfeature:\n mode: monitor_light'
Where
-
MONITORING_ACCESS_KEY is the ingestion key for the instance.
-
COLLECTOR_ENDPOINT is the public or private ingestion URL for the region where the monitoring instance is available. To get an endpoint, see Collector endpoints.
-
TAG_DATA are comma-separated tags that are formatted as TAG_NAME:TAG_VALUE. You can associate one or more tags to your monitoring agent. For example, role:serviceX,location:us-south.
-
Set sysdig_capture_enabled to false to disable the capture feature. By default is set to true. For more information, see Working with captures.
To install cURL, run
yum -q -y install curl
for RHEL, CentOS, and Fedora Linux distributions. -
-
Check that the monitoring agent is running. Run the following command:
ps -ef | grep sysdig
To see the latest monitoring agent logs, go to the directory
/opt/draios/logs
and check the log filedraios.log
.To look for errors, you can run the following command:
grep error /opt/draios/logs/draios.log
Checking the status of an agent by using the CLI
To check the status of an agent, run the following command:
service dragent status
Checking the version of an agent by using the CLI
To check the version of an agent, run the following command:
/opt/draios/bin/dragent --version
Updating a Linux agent
Complete the following steps to update a monitoring agent on Linux:
-
To update the agent from Debian and Ubuntu Linux distributions, run the following commands as the sudo user from a terminal:
sudo apt-get update
sudo apt-get -y install draios-agent
-
To update the agent from RHEL, CentOS, and Fedora Linux distributions, run the following commands as the sudo user from a terminal:
yum clean expire-cache
sudo yum -y install draios-agent
Removing a monitoring agent that has been deployed as a service in a Linux system
Complete the following steps to remove a monitoring agent on Linux:
-
To uninstall the agent from Debian and Ubuntu Linux distributions, run the following command as the sudo user from a terminal:
sudo apt-get remove draios-agent
-
To uninstall the agent from RHEL, CentOS, and Fedora Linux distributions, run the following command as the sudo user from a terminal:
sudo yum erase draios-agent
Viewing the logs of an agent
To see the latest monitoring agent logs, go to the directory /opt/draios/logs
and check the log file draios.log
.
To look for errors, you can run the following command:
grep error /opt/draios/logs/draios.log
Verifying the state of the agent
Check that the monitoring agent is running. Run the following command:
ps -ef | grep sysdig