[Mackerel] AWS EC2でのhost設定

EC2のMackerel導入手順。取り敢えず確認しておきます。

1. Amazon Linux 2 AMI (HVM), SSD Volume Typeでインスタンスをlaunch

2. mackerelの管理画面から新規ホストの登録を行います。

– Amazon Linux 2 LTS

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

3. sshログイン
$ ssh ec2-user@${ip} -i ~/.ssh/aws-dev.pem

4. 先ほどのyum setupを実行する

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

$ sudo /sbin/service mackerel-agent start
$ sudo journalctl -u mackerel-agent.service

mackerelの管理画面のHostsで確認します。

大丈夫そうですね。
テスト用なので、退役にして、ec2はterminateします。

よっしゃああああああああああああああ

VPSにMackerelをいれる

Mackerelのyumリポジトリを登録
[root@hoge ~]# curl -fsSL https://mackerel.io/file/script/setup-yum.sh | sh
This script requires superuser authority to configure Mackerel yum repository:
+ command -v curl
/usr/bin/curl
+ http_get=’curl -LfsS’
+ ‘[‘ ‘curl -LfsS’ = ” ‘]’
++ mktemp
+ gpgkey_path=/tmp/tmp.KrBsOelQWe
+ curl -LfsS https://mackerel.io/file/cert/GPG-KEY-mackerel
+ rpm –import /tmp/tmp.KrBsOelQWe
+ rm /tmp/tmp.KrBsOelQWe
+ cat
done
To install mackerel-agent type: sudo yum install mackerel-agent

その後、yumコマンドを用いてインストール
# sudo yum install -y mackerel-agent
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
epel/metalink | 8.7 kB 00:00
* base: ftp.iij.ad.jp
* epel: mirror.dmmlabs.jp
* extras: ftp.iij.ad.jp
* remi-safe: ftp.riken.jp
* updates: ftp.iij.ad.jp
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
epel | 3.2 kB 00:00
epel/primary | 3.2 MB 00:00
epel 12521/12521
extras | 3.4 kB 00:00
extras/primary_db | 25 kB 00:00
groonga | 2.9 kB 00:00
groonga/primary_db | 604 kB 00:00
mackerel | 2.5 kB 00:00
mackerel/primary_db | 5.8 kB 00:00
mongodb-org-3.4 | 2.5 kB 00:00
mongodb-org-3.4/primary_db | 73 kB 00:00
remi-safe | 2.9 kB 00:00
remi-safe/primary_db | 1.0 MB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.2 MB 00:00
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
–> Running transaction check
—> Package mackerel-agent.noarch 0:0.56.1-1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mackerel-agent noarch 0.56.1-1 mackerel 1.9 M

Transaction Summary
================================================================================
Install 1 Package(s)

Total download size: 1.9 M
Installed size: 4.6 M
Downloading Packages:
mackerel-agent-0.56.1-1.noarch.rpm | 1.9 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mackerel-agent-0.56.1-1.noarch 1/1
Verifying : mackerel-agent-0.56.1-1.noarch 1/1

Installed:
mackerel-agent.noarch 0:0.56.1-1

Complete!

[root@hoge ~]# sudo mackerel-agent init -apikey=””
You have mail in /var/spool/mail/root
[root@hoge ~]# sudo /etc/init.d/mackerel-agent start
Starting mackerel-agent: [ OK ]

すげ、きた

これすげ

Mackerel(マカレル)

はてなが開発した新世代のサーバ管理・監視サービス。
仮想サーバなどクラウドサービスをMackerelで統合管理および監視ができる。

-> box listを表示
MyCentOS>vagrant box list
bento/centos-6.7 (virtualbox, 2.2.7)
bento/centos-6.8 (virtualbox, 2.3.0)
trusty64 (virtualbox, 0)
ubuntu/trusty64 (virtualbox, 20161207.0.0)

Mackerelは入っていない。当然か。

これ打っていいのか。

vagrant box repackage mackerel/centos66 virtualbox 0.0.2

ちゃうちゃう、hatenaのサイトから無料トライアル