2017-04-06 21:29:29 -04:00
|
|
|
[[secure-monitoring]]
|
|
|
|
=== Monitoring and Security
|
|
|
|
|
|
|
|
<<xpack-monitoring, {monitoring}>> consists of two components: an agent
|
2017-08-10 15:56:03 -04:00
|
|
|
that you install on on each {es} and Logstash node, and a Monitoring UI
|
|
|
|
in {kib}. The monitoring agent collects and indexes metrics from the nodes
|
|
|
|
and you visualize the data through the Monitoring dashboards in {kib}. The agent
|
|
|
|
can index data on the same {es} cluster, or send it to an external
|
2017-04-06 21:29:29 -04:00
|
|
|
monitoring cluster.
|
|
|
|
|
|
|
|
To use {monitoring} with {security} enabled, you need to
|
2017-08-10 15:56:03 -04:00
|
|
|
{kibana-ref}/using-kibana-with-security.html[set up {kib} to work with {security}]
|
|
|
|
and create at least one user for the Monitoring UI. If you are using an external
|
|
|
|
monitoring cluster, you also need to configure a user for the monitoring agent
|
|
|
|
and configure the agent to use the appropriate credentials when communicating
|
|
|
|
with the monitoring cluster.
|
2017-04-06 21:29:29 -04:00
|
|
|
|
|
|
|
[float]
|
|
|
|
[[monitoring-ui-users]]
|
|
|
|
==== Setting Up Monitoring UI Users
|
|
|
|
|
2017-08-10 15:56:03 -04:00
|
|
|
When {security} is enabled, {kib} users are prompted to log in when they access
|
|
|
|
the UI. To use the Monitoring UI, a user must have access to the {kib} indices
|
2017-04-06 21:29:29 -04:00
|
|
|
and permission to read from the monitoring indices.
|
|
|
|
|
|
|
|
You set up Monitoring UI users on the cluster where the monitoring data is being
|
|
|
|
stored. To grant all of the necessary permissions, assign the user the
|
|
|
|
`monitoring_user` and `kibana_user` roles:
|
|
|
|
|
2017-08-10 15:56:03 -04:00
|
|
|
* If you're using the `native` realm, you can assign roles through {kib} or
|
2017-04-06 21:29:29 -04:00
|
|
|
with the <<managing-native-users, User Management API>>. For example, the following
|
|
|
|
command creates a user named `jacknich` and assigns him the `kibana_user` and
|
|
|
|
`monitoring_user` roles:
|
|
|
|
+
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
POST /_xpack/security/user/jacknich
|
|
|
|
{
|
|
|
|
"password" : "t0pS3cr3t",
|
|
|
|
"roles" : [ "kibana_user", "monitoring_user" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
* If you are using an LDAP or Active Directory realm, you can either assign roles
|
|
|
|
on a per user basis, or assign roles to groups of users. By default, role mappings
|
|
|
|
are configured in <<mapping-roles, `config/x-pack/role_mapping.yml`>>. For example,
|
|
|
|
the following snippet assigns the user named Jack Nicholson to the `kibana_user`
|
|
|
|
and `monitoring_user` roles:
|
|
|
|
+
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
kibana_user:
|
|
|
|
- "cn=Jack Nicholson,dc=example,dc=com"
|
|
|
|
monitoring_user:
|
|
|
|
- "cn=Jack Nicholson,dc=example,dc=com"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
[float]
|
|
|
|
[[configuring-monitoring-agent-security]]
|
|
|
|
==== Configuring Monitoring Agent to Communicate with a {security}-Enabled Monitoring Cluster
|
|
|
|
|
|
|
|
To configure the monitoring agent to communicate with a secured monitoring cluster:
|
|
|
|
|
2017-06-13 05:54:06 -04:00
|
|
|
. Configure a user on the monitoring cluster who has the `remote_monitoring_agent`
|
|
|
|
role, which is <<built-in-roles-remote-monitoring-agent, built-in to {xpack}>>.
|
2017-04-06 21:29:29 -04:00
|
|
|
For example:
|
|
|
|
+
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
POST /_xpack/security/user/agent-user
|
|
|
|
{
|
|
|
|
"password" : "t0pS3cr3t",
|
|
|
|
"roles" : [ "remote_monitoring_agent" ]
|
|
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
+
|
|
|
|
|
|
|
|
. On each node in the cluster being monitored, configure a Monitoring HTTP exporter
|
2017-08-10 15:56:03 -04:00
|
|
|
in `elasticsearch.yml` and restart {es}. In the exporter configuration,
|
2017-04-06 21:29:29 -04:00
|
|
|
you need to:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
.. Set the `type` to `http`.
|
|
|
|
.. Specify the location of the monitoring cluster in the `host` setting.
|
|
|
|
.. Provide the agent user credentials with the `username` and `password` settings.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
|
|
|
host: ["http://es-mon1:9200", "http://es-mon2:9200"]
|
|
|
|
auth:
|
|
|
|
username: agent-user
|
|
|
|
password: password
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
If SSL/TLS is enabled on the monitoring cluster:
|
|
|
|
|
|
|
|
.. Specify the HTTPS protocol when setting the monitoring server host.
|
|
|
|
.. Include the CA certificate in each node's trusted certificates in order to verify
|
|
|
|
the identities of the nodes in the monitoring cluster.
|
|
|
|
|
2017-08-10 15:56:03 -04:00
|
|
|
To add a CA certificate to an {es} node's trusted certificates, you
|
2017-04-06 21:29:29 -04:00
|
|
|
can specify the location of the PEM encoded certificate with the
|
|
|
|
`certificate_authorities` setting:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
|
|
|
host: ["https://es-mon1:9200", "https://es-mon2:9200"]
|
|
|
|
auth:
|
|
|
|
username: agent-user
|
|
|
|
password: password
|
|
|
|
ssl:
|
|
|
|
certificate_authorities: [ "/path/to/ca.crt" ]
|
|
|
|
id2:
|
|
|
|
type: local
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Alternatively, you can configure trusted certificates using a truststore
|
|
|
|
(a Java Keystore file that contains the certificates):
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.exporters:
|
|
|
|
id1:
|
|
|
|
type: http
|
|
|
|
host: ["https://es-mon1:9200", "https://es-mon2:9200"]
|
|
|
|
auth:
|
|
|
|
username: agent-user
|
|
|
|
password: password
|
|
|
|
ssl:
|
|
|
|
truststore.path: /path/to/file
|
|
|
|
truststore.password: password
|
|
|
|
id2:
|
|
|
|
type: local
|
|
|
|
--------------------------------------------------
|
|
|
|
--
|
|
|
|
|
|
|
|
. On each Logstash node being monitored, update `logstash.yml` to:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
.. Specify the location of the monitoring cluster and provide credentials
|
|
|
|
for the agent user:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.elasticsearch.url: ["http://es-mon-1:9200", "http://es-mon2:9200"]
|
|
|
|
xpack.monitoring.elasticsearch.username: "remote_monitor"
|
2017-06-29 16:27:57 -04:00
|
|
|
xpack.monitoring.elasticsearch.password: "x-pack-test-password"
|
2017-04-06 21:29:29 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
.. If SSL/TLS is enabled on the monitoring cluster:
|
|
|
|
|
|
|
|
* Specify the HTTPS protocol when setting the `elasticsearch.url`.
|
|
|
|
* Include the CA certificate in each node's trusted certificates in order to verify
|
|
|
|
the identities of the nodes in the monitoring cluster.
|
|
|
|
|
|
|
|
To add a CA certificate to an node's trusted certificates, you
|
|
|
|
can specify the location of the PEM encoded certificate with the
|
|
|
|
`xpack.monitoring.elasticsearch.ssl.ca` setting:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.elasticsearch.ssl.ca: [ "/path/to/ca.crt" ]
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
Alternatively, you can configure trusted certificates using a truststore
|
|
|
|
(a Java Keystore file that contains the certificates):
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
|
|
|
xpack.monitoring.elasticsearch.ssl.truststore.path: /path/to/file
|
2017-06-29 16:27:57 -04:00
|
|
|
xpack.monitoring.elasticsearch.ssl.truststore.password: x-pack-test-password
|
2017-04-06 21:29:29 -04:00
|
|
|
--------------------------------------------------
|
2017-08-10 15:56:03 -04:00
|
|
|
--
|