Monitoring Agent

The Amon Agent is a small piece of software that runs on your hosts. Its job is to collect metrics and send them to the Amon Server.

Installing the agent

Amon has a single binary collector agent, written in Go.

By default you can install it an all your servers with one line, displayed on your Servers page

API_KEY=unique_api_key bash -c "$(curl -L http://youramoninstance/install/)"

This will install the APT/Yum packages for the Amon Agent and will prompt you for your password.

By default the script installs:

  • The Amon agent to /opt/amonagent/amonagent and /usr/bin/amonagent (You can call amonagent from anywhere)

Agent configuration

The Amon agent has a single configuration file , which you can find at /etc/opt/amonagent/amonagent.conf. The configuration file is in JSON, so after editing it, please check if the syntax is valid at: http://jsonlint.com/.

The configuration file has the following parameters:

  • api_key - valid API key.
  • amon_instance - The URL Address where your Amon instance is running. This is where the agent will send data.
  • interval - (Optional) How often to gather metrics. In seconds, defaults to 60 seconds.

Below you can see a complete configuration file with all the options:

"api_key": "your-api-key",
"amon_instance": "https://youramoninstance",
"interval": 60

Running the agent

  • On sysv systems, the amonagent daemon can be controlled via service amonagent [action]
  • On systemd systems (such as Ubuntu 15+), the amonagent daemon can be controlled via systemctl [action] amonagent

Testing the agent

The agent executable is located in /opt/amonagent/amonagent(/usr/bin/amonagent) and accepts the following commands:

  • $ amonagent -test - Collects all system metrics and displays the results in the terminal.

Manually installing the agent

If the automatic installer fails, you can easily install the agent manually by pasting the following commands in the terminal:

# On Debian/Ubuntu
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv AD53961F
echo "deb http://packages.amon.cx/repo amon contrib" | sudo tee /etc/apt/sources.list.d/amon.list
sudo apt-get update
sudo apt-get install amonagent
echo '{
    "api_key":"your api-key",
    "amon_instance": "http://your amon instance IP"
}' > /etc/opt/amonagent/amonagent.conf

sudo service amonagent restart (or) sudo systemctl restart amonagent

# On Red Hat/Fedora/CentOS
echo -e '[amon]\nname = Amon.\nbaseurl = http://packages.amon.cx/rpm/\nenabled=1\ngpgcheck=0\npriority=1' > /etc/yum.repos.d/amon.repo
sudo yum -y install amonagent

echo '{
    "api_key":"your api-key",
    "amon_instance": "http://your amon instance IP"
}' > /etc/opt/amonagent/amonagent.conf

sudo service amonagent restart (or) sudo systemctl restart amonagent

Debugging the Agent

If you encountered an issue during the Agent installation please reach out to martin@amon.cx with the contents of amonagent-install.log

If you get the Agent installed but you are not seeing any data in Amon, you can troubleshoot in the following manner.
First, run the status command - sudo service amonagent status (or) sudo systemctl status amonagent.

If the agent is running, check if the Amon API is accessible from your server:

$ amonagent -test

You should also check the logs: /var/log/amonagent.log. Errors in the logs may also reveal the cause of any issues.

If non of these steps solve the problem, please send the logs as attachment to support[at]amon.cx.