Elastic Stack 7 : Heartbeat インストール2019/06/18 |
|
サービスの死活監視機能を提供する Heartbeat をインストールします。
|
|
| [1] | Heartbeat をインストールします。 事前に Elasticsearch リポジトリ設定済みであることが前提です。 |
|
[root@dlp ~]# yum -y install heartbeat-elastic
|
| [2] | 基本的な設定をして Heartbeat を起動します。 |
|
[root@dlp ~]#
vi /etc/heartbeat/heartbeat.yml # 23行目:監視の設定 # デフォルトは以下のように 10分毎に http://localhost:9200 を監視する設定がされている heartbeat.monitors: - type: http # List or urls to query urls: ["http://localhost:9200"] # Configure task schedule schedule: '@every 10s' # Total test connection and data exchange timeout #timeout: 16s ..... ..... # 74行目:Kibana を使用する場合はコメント解除して出力先を指定 # Kibana で SSL 有効の場合は証明書に登録したホスト名と合わせる
setup.kibana:
.....
host: "https://dlp.srv.world:5601"
# 105行目:出力先を指定する # デフォルト出力先は以下のように localhost の Elasticsearch # Logstash に出力する場合はコメントアウトして output.logstash 行関連を有効にする output.elasticsearch: # Array of hosts to connect to.l hosts: ["localhost:9200"] ..... ..... #output.logstash: # The Logstash hosts #hosts: ["localhost:5044"]
[root@dlp ~]#
vi /etc/heartbeat/heartbeat.reference.yml # 24行目:デフォルトでは 5分毎にローカルホストを ICMP 監視する設定
heartbeat.monitors:
- type: icmp # monitor type `icmp` (requires root) uses ICMP Echo Request to ping
# configured hosts
# Monitor name used for job name and document type.
#name: icmp
# Enable/Disable monitor
#enabled: true
# Configure task schedule using cron-like syntax
schedule: '*/5 * * * * * *' # exactly every 5 seconds like 10:00:00, 10:00:05,...
# List of hosts to ping
hosts: ["localhost"]
.....
.....
# 87行目:任意の TCP ポートの監視設定セクション (デフォルトはローカルホストの 9200 のみ)
- type: tcp # monitor type `tcp`. Connect via TCP and optionally verify endpoint
# by sending/receiving a custom payload
# Monitor name used for job name and document type
#name: tcp
# Enable/Disable monitor
#enabled: true
# Configure task schedule
schedule: '@every 5s' # every 5 seconds from start of beat
.....
.....
hosts: ["localhost:9200"]
.....
.....
[root@dlp ~]# systemctl start heartbeat-elastic [root@dlp ~]# systemctl enable heartbeat-elastic
|
| [3] | データが取り込まれているか確認しておきます。 |
|
# index 一覧 [root@dlp ~]# curl localhost:9200/_cat/indices?v health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open .kibana_1 OD2lQaCLQFeG7RQbYXigEA 1 0 1526 110 910.4kb 910.4kb yellow open test_index u5nanOeOSCmGbSIlrqluZA 1 1 1 0 5.2kb 5.2kb yellow open packetbeat-7.1.1-2019.06.14-000001 azF2ujw4RAeZ9pgdDvRBUg 1 1 7636 0 5.5mb 5.5mb green open .kibana_task_manager yuJ1nGaBSDeoeP6GToztbg 1 0 2 0 12.8kb 12.8kb yellow open heartbeat-7.1.1-2019.06.14-000001 XdKYmJr1QKmj1LOtVaz-hQ 1 1 2 0 35.7kb 35.7kb yellow open sshd_fail-2019.06 Q689hZJTTjG6beQ6XtZsXw 1 1 33 0 74.9kb 74.9kb yellow open metricbeat-7.1.1-2019.06.14-000001 5cFmXcywQVWZTKvPMsZdoQ 1 1 7784 0 5.1mb 5.1mb yellow open filebeat-7.1.1-2019.06.14-000001 sWGv-hPVRuqon6m4ElZYng 1 1 41222 0 7.8mb 7.8mb # indexのドキュメント一覧 [root@dlp ~]# curl localhost:9200/heartbeat-7.1.1-2019.06.14-000001/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 5,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "heartbeat-7.1.1-2019.06.14-000001",
"_type" : "_doc",
"_id" : "cyf4VGsBAsE_Rtb7s7_i",
"_score" : 1.0,
"_source" : {
"@timestamp" : "2019-06-14T07:51:51.999Z",
"tcp" : {
"rtt" : {
"connect" : {
"us" : 1174
}
}
},
.....
.....
|
| Sponsored Link |
|
|