Installing mackerel-agent in Amazon Linux

First, register Mackerel’s yum repository:

curl -fsSL | sh

Then, you can install it using the yum command:

sudo yum install -y mackerel-agent

Edit the configuration file

Configure the API key at /etc/mackerel-agent/mackerel-agent.conf. The configuration can be performed with the following command.

sudo mackerel-agent init -apikey="<YOUR_API_KEY>"

The API key can be confirmed from the organization’s page. Because the organization can be identified by this API key, please be careful as to not allow it to be leaked to the outside.

For more details, check out the mackerel-agent specifications help page.

By using the configuration file, the following can be implemented:

Starting the agent

Agent will start by running the following command:

sudo /sbin/service mackerel-agent start

The agent’s log is output to /var/log/mackerel-agent.log.

When the agent begins to run properly, it will be registered as a host in Mackerel. Please confirm this in dashboards etc.

Uninstall the agent

To uninstall mackerel-agent, run the following command.

sudo yum erase mackerel-agent

By doing so, a file with the host ID documented will remain (at /var/lib/mackerel-agent/id under default settings), so please make sure to delete it.