25
26

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.

CentOS 6.6にSensuインストール(監視サーバ側)

Last updated at Posted at 2015-01-19

以下はChef/Puppetを使わずにCentOS 6.6にインストールする手順。

下記手順をもとに進める。
http://sensuapp.org/docs/0.16/guide

SSL証明書

SSL証明書/認証局作成

# cd /tmp
# wget http://sensuapp.org/docs/0.16/tools/ssl_certs.tar
# tar xvf ssl_certs.tar
ssl_certs/
ssl_certs/sensu_ca/
ssl_certs/ssl_certs.sh
ssl_certs/sensu_ca/openssl.cnf
# cd ssl_certs
# ./ssl_certs.sh generate

RabbitMQインストール

erlangインストール

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# yum install erlang

RabbitMQインストール

# rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
# rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.1/rabbitmq-server-3.2.1-1.noarch.rpm

RabbitMQ server起動

# chkconfig rabbitmq-server on
# service rabbitmq-server start

SSL設定

# mkdir -p /etc/rabbitmq/ssl
# cp -a sensu_ca/cacert.pem /etc/rabbitmq/ssl/
# cp -a server/cert.pem /etc/rabbitmq/ssl/
# cp -a server/key.pem /etc/rabbitmq/ssl/

RabbitMQ SSL設定

# vi /etc/rabbitmq/rabbitmq.config
/etc/rabbitmq/rabbitmq.config
[
    {rabbit, [
    {ssl_listeners, [5671]},
    {ssl_options, [{cacertfile,"/etc/rabbitmq/ssl/cacert.pem"},
                   {certfile,"/etc/rabbitmq/ssl/cert.pem"},
                   {keyfile,"/etc/rabbitmq/ssl/key.pem"},
                   {verify,verify_peer},
                   {fail_if_no_peer_cert,true}]}
  ]}
].

RabbitMQ再起動。

# service rabbitmq-server restart

Sensu用のRabbitMQ vhost作成

# rabbitmqctl add_vhost /sensu

Sensu用のRabbitMQユーザ作成・パーミッション付与

rabbitmqctl add_user sensuの後は適宜任意のパスワードを指定すること。

# rabbitmqctl add_user sensu rabbitmq-sensu-password
# rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"

RabbitMQ web management console 有効化

# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.

RabbitMQ再起動。

# service rabbitmq-server restart

管理アカウント作成。
※ユーザ名・パスワードは適宜変更すること
https://www.rabbitmq.com/man/rabbitmqctl.1.man.html#User%20management
https://www.rabbitmq.com/man/rabbitmqctl.1.man.html#set_user_tags

# rabbitmqctl add_user admin rabbitmq-admin-password
Creating user "admin" ...
...done.
# rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...
...done.

ブラウザから下記にアクセスすれば、RabbitMQ web management consoleにアクセス可能。
http://<Server IP>:15672/

Redisインストール

Redisインストール

# yum install redis

Redis起動

# chkconfig redis on
# service redis start

Sensuインストール

リポジトリ設定ファイル作成

# vi /etc/yum.repos.d/sensu.repo
/etc/yum.repos.d/sensu.repo
[sensu]
name=sensu-main
baseurl=http://repos.sensuapp.org/yum/el/$releasever/$basearch/
gpgcheck=0
enabled=1

sensuインストール

# yum install sensu

Sensu設定

Sensu用のSSL証明書ファイル配置ディレクトリ作成

# mkdir -p /etc/sensu/ssl

作成済みのSSL証明書ファイルを/etc/sensu/ssl配下にコピー

# cp -a client/cert.pem /etc/sensu/ssl/
# cp -a client/key.pem /etc/sensu/ssl/

/etc/sensu/conf.d/rabbitmq.json作成

  • user/password -> Sensu用のRabbitMQユーザ作成・パーミッション付与で設定したもの
# vi /etc/sensu/conf.d/rabbitmq.json
/etc/sensu/conf.d/rabbitmq.json
{
  "rabbitmq": {
    "ssl": {
      "cert_chain_file": "/etc/sensu/ssl/cert.pem",
      "private_key_file": "/etc/sensu/ssl/key.pem"
    },
    "host": "localhost",
    "port": 5671,
    "vhost": "/sensu",
    "user": "sensu",
    "password": "rabbitmq-sensu-password"
  }
}

/etc/sensu/conf.d/redis.json作成

# vi /etc/sensu/conf.d/redis.json
/etc/sensu/conf.d/redis.json
{
  "redis": {
    "host": "localhost",
    "port": 6379
  }
}

Sensu API設定

/etc/sensu/conf.d/api.json作成

※user/passwordは適宜変更すること

# vi /etc/sensu/conf.d/api.json
/etc/sensu/conf.d/api.json
{
  "api": {
    "host": "localhost",
    "port": 4567,
    "user": "admin",
    "password": "sensu-api-admin-password"
  }
}

Sensu clients設定

/etc/sensu/conf.d/client.json作成

  • name -> Sensuサーバのホスト名
  • address -> SensuサーバのIPアドレス

※name/addressは適宜変更すること

# vi /etc/sensu/conf.d/client.json
/etc/sensu/conf.d/client.json
{
  "client": {
    "name": "Sensu-Server",
    "address": "127.0.0.1",
    "subscriptions": [ "all" ]
  }
}

Sensu起動

# chkconfig sensu-server on
# chkconfig sensu-client on
# chkconfig sensu-api on
# service sensu-server start
# service sensu-client start
# service sensu-api start

Dashboard

25
26
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
25
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?