🐟

[macOS] Install_mackerel-agent

2020/09/29に公開

published_at: 2019-01-21 08:42


Background

  • macOS Mojave 10.14.2
  • Homebrew 1.9.2

Process

see : https://mackerel.io/ja/docs/entry/howto/install-agent/mac

mackerel-agent のインストール
❯ brew install mackerelio/mackerel-agent/mackerel-agent
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
entityx                                               gerbil-scheme                                         tmx
==> Updated Formulae
bettercap              cp2k                   hub                    libxc                  rdfind                 scrcpy                 sile

==> Tapping mackerelio/mackerel-agent
Cloning into '/usr/local/Homebrew/Library/Taps/mackerelio/homebrew-mackerel-agent'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 8 (delta 1), reused 2 (delta 0), pack-reused 0
Unpacking objects: 100% (8/8), done.
Tapped 2 formulae (36 files, 36.6KB).
==> Installing mackerel-agent from mackerelio/mackerel-agent
==> Downloading https://github.com/mackerelio/mackerel-agent/releases/download/v0.59.0/mackerel-agent_darwin_amd64.zip
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/19845168/ccab5d80-14f0-11e9-96d8-ebe6451732d2?X-Amz-Algorithm=AWS4-HMAC-SHA
######################################################################## 100.0%
==> Caveats
You must append `apikey = {apikey}` configuration variable to /usr/local/etc/mackerel-agent.conf
in order for mackerel-agent to work.

To have launchd start mackerelio/mackerel-agent/mackerel-agent now and restart at login:
  brew services start mackerelio/mackerel-agent/mackerel-agent
Or, if you don't want/need a background service you can just run:
  mackerel-agent -conf /usr/local/etc/mackerel-agent.conf
==> Summary
🍺  /usr/local/Cellar/mackerel-agent/0.59.0: 8 files, 7.5MB, built in 13 seconds

~ 37s
API key 登録
❯ sudo mackerel-agent init -apikey="{api_key}" -conf /usr/local/etc/mackerel-agent.conf
Password: (-> your_password)
mackerel-agent 起動
~
❯ ps -ef | grep mackerel-agent
  501 14093 12825   0  8:12AM ttys004    0:00.01 grep --color=auto mackerel-agent

~
❯ brew services start mackerel-agent
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 17 (delta 0), reused 12 (delta 0), pack-reused 0
Unpacking objects: 100% (17/17), done.
Tapped 1 command (50 files, 62.2KB).
==> Successfully started `mackerel-agent` (label: homebrew.mxcl.mackerel-agent)

~ 9s
❯ ps -ef | grep mackerel-agent
  501 14618     1   0  8:12AM ??         0:00.03 /usr/local/opt/mackerel-agent/bin/mackerel-agent supervise -conf /usr/local/etc/mackerel-agent.conf
  501 14633 14618   0  8:12AM ??         0:00.02 /usr/local/opt/mackerel-agent/bin/mackerel-agent -conf /usr/local/etc/mackerel-agent.conf -child
  501 14637 12825   0  8:12AM ttys004    0:00.00 grep --color=auto mackerel-agent
自動起動設定確認
~
❯ launchctl list | grep homebrew
14618	0	homebrew.mxcl.mackerel-agent

refs

Note

  • 正直、macOS での自動起動設定を初めて知った

Discussion