Mackerel offers mackerel-agent’s Homebrew Tap for macOS. Monitoring of a macOS machine can be done by following the procedure below.
However, please note that macOS is not officially supported for mackerel-agent. For a list of supported OS, check here.
Installing mackerel-agent
With Homebrew's preinstalled environment, the agent can be installed by executing the following command.
brew install mackerelio/mackerel-agent/mackerel-agent
Edit the configuration file
The agent configuration file installed with Homebrew is placed in $(brew --prefix)/etc/mackerel-agent.conf
.
Before starting-up the agent, you need to configure an API key in the configuration file. The API key can be configured with the following command.
mackerel-agent init -apikey="<YOUR_API_KEY>" -conf "$(brew --prefix)/etc/mackerel-agent.conf"
You can check API keys from the Organization page. Please be careful to not allow this API key to be leaked to the outside as it is used to identify the organization.
For details, refer to the mackerel-agent specifications page.
The following can be achieved using the configuration file:
Startup/stop the agent
To startup and stop the agent, execute the following commands respectively.
brew services start mackerel-agent
brew services stop mackerel-agent
The agent log is output to $(brew --prefix)/var/log/mackerel-agent.log
When the agent starts to run correctly, it will be registered as a host in Mackerel. This can be confirmed from the Dashboard etc.