Documentation is now available for the Fall 2020 Update release!

Deploying Agents on Linux

Describes how to deploy agents on a server, deploy agents on docker containers, configure and uninstall.

Leave Feedback

Prerequisites

System requirements:

  • Processor: 1 GHz CPU or greater
  • Memory: 2 GB RAM
  • Disk Space: 200 MB

Deploying agents on single servers

Deploying agents involve three steps:

  1. Download an agent on the server
  2. Install the agent on the server
  3. Configure and connect the Agent

Downloading agent on single server

Agent is available in two formats. Use any of the following based on your requirement to download:

  • Deploy Script: Agent deployment script is a python based script and runs on any Linux-based operating systems. This script identifies the operating system on the server and downloads the required package from OpsRamp application and installs the agent. The server is connected to OpsRamp automatically after a successful installation.
  • Package: A package is a complete installation file and you need to download the required file based on your operating system. After installing the package, configure the agent to connect your server to OpsRamp.

To download an agent onto a server, from the OpsRamp console:

  1. From All Clients, select the client.
  2. Go to Setup > Downloads > Agent.
  3. From the Linux section, click Download agent deployment script or Download agent package for individual Linux distribution.

Installing agent on single server

Before installing an agent you have an option to run the agent either with root user or non-root user. For non-root user,

  • By default Agent creates a user account with the name opsramp and installs the agent.
  • To run the agent with a custom user, create a user.

Installing an agent using deploy script

Download the deployAgent.py script and install the agent using one of the following options:

  • Root: sudo python deployAgent.py

  • Non-root (OpsRamp user): sudo python deployagent.py -n yes

    Note: -n indicates that you are installing agent with non-root user opsramp.

  • Non-root (Custom user): Before installing an agent with a custom user, you need to create a user account, group, and set password.

    • Create user: groupadd --system <username>
    • Create Group: useradd -g <username> -d /opt/opsramp -m <username> -s /bin/sh --system
    • Set a password for the user: echo <username>:pwd | chpasswd

    Install the agent: sudo python deployAgent.py -R <username>

    Note: -R indicates that you are installing an agent with a non-root custom user.

Installing an agent with limited features

By default, agent is installed with all features enabled. This includes Remote Command, Patch Management, Automation, Remote Console. You can even install the agent with only the core functionalities. During installation, use the -f option and specify one or more features.

Example to install an agent with Patch Management and Automation features

sudo python deployAgent.py -f "agent:PatchManagement,agent:Automation"

Example to install an agent with only core features

sudo python deployAgent.py -f "agent:Core"

Installing an agent using the package

Download the desired package for your operating system.

Note: Use dpkg -i for Debian based operating systems and rpm -i for Red Hat-based operating systems.

Install the agent using one of the following options:

  • Root: sudo dpkg -i <opsramp-agent-package.deb>

  • Non-root (OpsRamp user): sudo ISNONROOT=YES <opsramp-agent-package.deb>

  • Non-root (Custom user): Before installing an agent with a custom user, you need to create a user account, group, and set password.

    • Create user: groupadd --system <username>
    • Create Group: useradd -g <username> -d /opt/opsramp -m <username> -s /bin/sh --system
    • Set a password for the user: echo <username>:pwd | chpasswd

    Install the agent: sudo AGENTUSER=<username> dpkg -i <opsramp-agent_package.deb>

Configure and connect the Agent

After installing the agent using the package, you have to provide the KEY, SECRET, and API URL to connect the agent to OpsRamp.

Get the details from Setup-> Downloads -> Agent -> Instruction page.

Example to configure an agent with all features enabled

sudo python /opt/opsramp/agent/bin/configure.py -K <key> -S <secret> -s <api_url>

During configuration, you can use the -f option and specify one or more features.

Example to configure an agent with Patch Management and Automation features

sudo python /opt/opsramp/agent/bin/configure.py -K <key> -S <secret> -s <api_url> -f "agent:PatchManagement,agent:Automation"

Example to install an agent with only core features

sudo python /opt/opsramp/agent/bin/configure.py -K <key> -S <secret> -s <api_url> -f  "agent:Core"

Deploying agents on multiple servers

Use a software deployment tool, such as Chef Recipe and Puppet Cookbook. You can use the Ansible agent deployment solution provided by OpsRamp.

Deploying agents as docker containers

Execute the below command in the host machine.

  • Without Proxy

    docker run -d –net=host –name=opsramp-agent -v
    /var/run/docker.sock:/var/run/docker.sock -e AGENT_API_KEY=<api-key> -e
    AGENT_API_SECRET=<secret> -e APP_SERVER=<app server> -e LOG_LEVEL=”warn” -e
    DOCKER_CONTAINER=”TRUE” -e opsramp/agent
    
  • With Proxy

    docker run -d –net=host –name=opsramp-agent -v
    /var/run/docker.sock:/var/run/docker.sock -e
    AGENT_API_KEY=<api-key> -e AGENT_API_SECRET=<secret> -e APP_SERVER=<app server> -e LOG_LEVEL=”warn” -e
    DOCKER_CONTAINER=”TRUE” -e PROXY_SERVER=<proxy_server_ip> -e PROXY_PORT=<proxy-port> -e PROXY_USER=<proxy username> -e PROXY_PASSWORD=<proxy password> -m CONN_MODE=proxy
    opsramp/agent
    

The following are the validations to check if you are using the default seccomp profile:

1. docker info | grep Profile
WARNING: You’re not using the default seccomp profile
Profile: /etc/docker/seccomp.json
2. docker run -v /var/run/docker.sock:/var/run/docker.sock –rm byrnedo/alpine-curl curl –unix-socket /var/run/docker.sock http:/localhost/info
curl: (7) Couldn’t connect to server
curl: (7) Couldn’t connect to server
Example:
docker run -d –net=host –name=opsramp-agent –security-opt label:disable -v /var/run/docker.sock:/var/run/docker.sock -e AGENT_API_KEY=”<api-key>” -e AGENT_API_SECRET=”<secret>” -e APP_SERVER=”<app server>” -e LOG_LEVEL=”warn” -e DOCKER_CONTAINER=”TRUE” -e opsramp/agent

Handling docker events

The onboarded containers are available at the Infrastructure page. OpsRamp triggers alerts for events start, kill, and oom (out-of-memory) generated on the containers.

When you delete a Container from the Docker host, OpsRamp triggers an alert

Stop receiving Docker alerts

To stop receiving Docker alerts::

  1. On the host resource (Agent installed resource), navigate to /opt/opsramp/agent/conf.
  2. Edit the configuration file: /opt/opsramp/agent/conf/configuration.properties
  3. Provide 0 (zero) as value for the docker_events field.

Uninstalling agents

You can uninstall agent with the options to manage or unmanage the server.

Uninstalling agent without unmanaging the server

On a server run the following commands:

  • For Debian: Uninstalling agent sudo dpkg -P opsramp-agent

  • For Red Hat: Uninstalling agent: sudo rpm -e opsramp-agent

    Removing any files related to the agent: sudo rm -rf /opt/opsramp

Uninstalling agent and unmanaging the server

To uninstall the agent and unmanage the server:

  1. Go to Infrastructure and from the list of resources, select the resources from which you want to uninstall the agent.
  2. Click Unmanage Devices.
  3. Click OK for confirmation.