やさぐれSEの技術メモ

皆が辛い思いをしないようにハマったポイントなどを書きます

Kibanaのインストール及び設定

前回まででElasticsearchの設定について一通り記述しましたので、今回はKibanaのインストールと設定方法を記述します。

Kibanaのインストール

(1)Kibanaをダウンロードします。
# wget https://artifacts.elastic.co/downloads/kibana/kibana-6.2.2-x86_64.rpm

(2)Kibanaのインストールを実施します。
# rpm --install kibana-6.2.2-x86_64.rpm

インストールが正常に完了したことを確認します。
# echo $?

(3)サービスの自動登録をします。(※まだ起動しません)

# systemctl daemon-reload
# systemctl enable kibana.service

X-Packのインストール

公式HP

www.elastic.co

(1)X-Packのダウンロードをします。
# wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-6.2.2.zip

(2)X-Packのインストールを実施します。

最初普通にインストールして上手く行かず、海外サイトを調べていたところkibanaユーザで実施する必要があると発見しました。Elasticsearch側は普通にインストールできるのに、Kibanaは何故なんでしょう。

# sudo -u kibana /usr/share/kibana/bin/kibana-plugin install file:///root/x-pack-6.2.2.zip
Attempting to transfer from file:///root/x-pack-6.2.1.zip
Transferring 314111900 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Extracting plugin archive
Extraction complete
Optimizing and caching browser bundles...
Plugin installation complete

Kibanaの設定

(1)コンフィグの修正を実施します。

# cp -p /etc/kibana/kibana.yml /etc/kibana/kibana.yml.org
# diff /etc/kibana/kibana.yml /etc/kibana/kibana.yml.org
# vi /etc/kibana/kibana.yml

設定箇所に ★ をつけます。

# Kibana is served by a back end server. This setting specifies the port to use.
#server.port: 5601

# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
#server.host: "localhost"

# ★アクセス許可IPアドレスの設定(0.0.0.0でどのIPでも許可します)
server.host: "192.168.0.0"

# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
# to Kibana. This setting cannot end in a slash.
#server.basePath: ""

# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576

# The Kibana server's name.  This is used for display purposes.
#server.name: "your-hostname"

# ★kibanaのサーバ名設定。elasticsearchのように${HOSTNAME}は使えないようです。
server.name: kibana

# The URL of the Elasticsearch instance to use for all your queries.
#elasticsearch.url: "http://localhost:9200"

# ★kibanaが接続するelasticsearchのノード設定。clientノードを指定します。
elasticsearch.url: "http://192.168.0.3:9200"

# When this setting's value is true Kibana uses the hostname specified in the server.host
# setting. When the value of this setting is false, Kibana uses the hostname of the host
# that connects to this Kibana instance.
#elasticsearch.preserveHost: true

# Kibana uses an index in Elasticsearch to store saved searches, visualizations and
# dashboards. Kibana creates a new index if the index doesn't already exist.
#kibana.index: ".kibana"

# The default application to load.
#kibana.defaultAppId: "home"

# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
#elasticsearch.username: "user"
#elasticsearch.password: "pass"

# ★x-packを使用してセキュリティ有効化している場合は認証設定が必要です。
# 接続ユーザは「kibana」を使用します。
elasticsearch.username: "kibana"
elasticsearch.password: "ビルトインアカウントのパスワード変更で指定したパスワード"

# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
# These settings enable SSL for outgoing requests from the Kibana server to the browser.
#server.ssl.enabled: false
#server.ssl.certificate: /path/to/your/server.crt
#server.ssl.key: /path/to/your/server.key

# Optional settings that provide the paths to the PEM-format SSL certificate and key files.
# These files validate that your Elasticsearch backend uses the same key files.
#elasticsearch.ssl.certificate: /path/to/your/client.crt
#elasticsearch.ssl.key: /path/to/your/client.key

# Optional setting that enables you to specify a path to the PEM file for the certificate
# authority for your Elasticsearch instance.
#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]

# To disregard the validity of SSL certificates, change this setting's value to 'none'.
#elasticsearch.ssl.verificationMode: full

# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
# the elasticsearch.requestTimeout setting.
#elasticsearch.pingTimeout: 1500

# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
# must be a positive integer.
#elasticsearch.requestTimeout: 30000

# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
# headers, set this value to [] (an empty list).
#elasticsearch.requestHeadersWhitelist: [ authorization ]

# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
#elasticsearch.customHeaders: {}

# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
#elasticsearch.shardTimeout: 0

# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying.
#elasticsearch.startupTimeout: 5000

# Specifies the path where Kibana creates the process ID file.
#pid.file: /var/run/kibana.pid

# Enables you specify a file where Kibana stores log output.
# デフォルトではログファイルが作成されません。何かあった場合にここにログファイルのパスを指定してデバッグを行います。
# ファイルの作成はしてくれないので、自分で作成します。
# コマンド例)touch /var/log/kibana.log
# コマンド例)chown kibana:kibana /var/log/kibana.log
#logging.dest: stdout ←/var/log/kibana.logを指定します

# Set the value of this setting to true to suppress all logging output.
#logging.silent: false

# Set the value of this setting to true to suppress all logging output other than error messages.
#logging.quiet: false

# Set the value of this setting to true to log all events, including system usage information
# and all requests.
#logging.verbose: false

# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
#ops.interval: 5000

# The default locale. This locale can be used in certain circumstances to substitute any missing
# translations.
#i18n.defaultLocale: "en"

# ★x-packに関する定義を行う
## X-Pack
#Graph Settings
xpack.graph.enabled: false

#★Monitoring Settings
# General Monitoring Settings
xpack.monitoring.enabled: true

#R★eporting Settings
# General Reporting Settings
xpack.reporting.enabled: true

#★Security Settings
# General Security Settings : Defalut true
xpack.security.enabled: true

(2)Kibanaを起動します。
# systemctl start kibana.service

※エラーが出ないことを確認してください。

Kibanaに接続する

(1)ブラウザでKibanaに接続します。
http://Kibanaのホスト名又はIP:5601

(2)Kibanaのログイン画面が表示されたら、ユーザ名に「elastic」、パスワードを入力してログインをしてください。

※画像が無くすみません!

以上で環境が整い、使えるはずです!