Installing mackerel-agent in Amazon Linux

The content described on this page is also available from the New Host registration screen in Mackerel.

When using Amazon Linux 2 LTS

Execute the following command:

curl -fsSL https://mackerel.io/file/script/amznlinux/setup-all-yum-v2.sh | MACKEREL_APIKEY='<YOUR_API_KEY>' sh

You can check the API key from the Organization page’s API Keys tab. Keep in mind that this key is used to identify your organization, so we strongly advise not sharing it with others.

When using Amazon Linux

Execute the following command:

curl -fsSL https://mackerel.io/file/script/amznlinux/setup-all-yum.sh | MACKEREL_APIKEY='<YOUR_API_KEY>' sh

You can check the API key from the Organization page’s API Keys tab. Keep in mind that this key is used to identify your organization, so we strongly advise not sharing it with others.

Edit the configuration file

Edit the file /etc/mackerel-agent/mackerel-agent.conf and configure the API key.

apikey = "<YOUR_API_KEY>"

You can check the API key from the Organization page’s API Keys tab. Keep in mind that this key is used to identify your organization, so we strongly advise not sharing it with others.

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

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

Starting the agent

When using Amazon Linux 2 LTS

The agent will start by running the following command:

sudo systemctl start mackerel-agent

The log is output to Journal. You can check the mackerel-agent log with the following command.

sudo journalctl -u mackerel-agent.service

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

When using Amazon Linux

The 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.