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 Ubuntu 16.04 / Debian 8 or later

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.

Using Ubuntu 14.04

Execute the following command:

wget -q -O - https://mackerel.io/file/script/setup-all-apt.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.

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

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

Using Ubuntu 16.04 / Debian 8 or later

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.

When using Ubuntu 14.04

Executing the following command starts the agent.

sudo /etc/init.d/mackerel-agent start

You can find the log file here: /var/log/mackerel-agent.log.

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.