7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ansibleを使って各環境にmackerel-agentを入れて監視対象ホストにしてみよう

Last updated at Posted at 2015-07-24

今回はAnsibleを使って、mackerel-agentをインストールし設定ファイルに追記、エージェント起動しMackerelで監視対象ホストへ追加するplaybookを作成しました。

mackerel

mackerelのサービスについては、まずこちらでご確認ください。
アカウント作成時は、無料トライアルは14日です。まずは無料トライアルでどのようなサービスか触ってみて下さい。

hosts

[web]
dev-web ansible_connection=ssh
stg-web ansible_connection=ssh
prod-web1 ansible_connection=ssh
prod-web2 ansible_connection=ssh

[dev]
dev-web ansible_connection=ssh

[stg]
stg-web ansible_connection=ssh

[prod]
prod-web1 ansible_connection=ssh
prod-web2 ansible_connection=ssh

playbook

mackerele-agent.yml
---
- hosts: web
  sudo: yes
  tasks:
    - name: install mackerel agent
      shell: curl -fsSL https://mackerel.io/assets/files/scripts/setup-yum.sh | sh

    - name: install yum mackerel angent
      yum: name=mackerel-agent state=installed

    - name: configure /etc/mackerel-agent/mackerel-agent.conf
      lineinfile: dest=/etc/mackerel-agent/mackerel-agent.conf line='apikey = "xxxxxxxxxxxxxxx"'

    - name: start mackerel-agent
      command: '/etc/init.d/mackerel-agent start'
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?