Installing mackerel-agent in Ubuntu / Debian

KCPS edition Mackerel users, click here.

Contents described on this page are also available from the New host registration screen in Mackerel.

Using apt

Execute the following command:

wget -q -O - https://mackerel.io/file/script/setup-all-apt-v2.sh | MACKEREL_APIKEY='<YOUR_API_KEY>' sh

You can obtain the API key from the API key tab on your organization's page. Keep in mind this key is used to identify your organization, so we strongly advise not sharing it with others.

Updates can be performed using the apt-get command.

sudo apt-get update
sudo apt-get install mackerel-agent

Using dpkg

Download the deb file:

curl -LO https://mackerel.io/file/agent/deb/mackerel-agent_latest.all.deb

Use dpkg to install:

sudo dpkg -i mackerel-agent_latest.all.deb

When updating, redownload the package file and perform the same procedure.

Editing configuration files

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

apikey = "<YOUR_API_KEY>"

You can obtain the API key from the API key tab on your organization's page. Keep in mind this key is used to identify your organization, so we strongly advise not sharing it with others.

For more information, please visit mackerel-agent specifications.

Using configuration files the following can be realized:

Launching mackerel-agent

Executing the following command starts the agent.

sudo systemctl start mackerel-agent

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

sudo journalctl -u mackerel-agent.service

Once the agent starts functioning properly, the host will be registered with Mackerel, which you can confirm by checking the Dashboard.

Uninstalling mackerel-agent

To uninstall Mackerel-agent implement one of the following commands:

If the agent was installed with apt-get:

sudo apt-get remove mackerel-agent

If the agent was installed with dpkg:

sudo dpkg -r mackerel-agent

Then, do not forget to delete the file /var/lib/mackerel-agent/id (by default) which contains the host ID.

Installing the KCPS version of mackerel-agent with a deb package

Deb packages are not supported in KCPS editions of Mackerel.