:modulename: apache mysql

[id="{beatname_lc}-installation-configuration"]
== {beatname_uc} quick start: installation and configuration

++++
<titleabbrev>Quick start: installation and configuration</titleabbrev>
++++

{beatname_uc} helps you monitor your servers and the services they host by
collecting metrics from the operating system and services.

This guide describes how to get started quickly with metrics collection.
You'll learn how to:

* install {beatname_uc} on each system you want to monitor
* specify the metrics you want to collect
* send the metrics to {es}
* visualize the metrics data in {kib}

[role="screenshot"]
image::./images/{beatname_lc}-system-dashboard.png[{beatname_uc} System dashboard]

[float]
=== Before you begin

You need {es} for storing and searching your data, and {kib} for visualizing and
managing it.

include::{libbeat-dir}/tab-widgets/spinup-stack-widget.asciidoc[]

[float]
[[install]]
=== Step 1: Install {beatname_uc}

Install {beatname_uc} as close as possible to the service you want to monitor.
For example, if you have four servers with MySQL running, it's recommended that
you run {beatname_uc} on each server. This allows {beatname_uc} to access your
service from localhost and does not cause any additional network traffic or
prevent {beatname_uc} from collecting metrics when there are network problems.
Metrics from multiple {beatname_uc} instances will be combined on the
Elasticsearch server.

To download and install {beatname_uc}, use the commands that work with your
system:

include::{libbeat-dir}/tab-widgets/install-widget.asciidoc[]

[float]
[[other-installation-options]]
==== Other installation options

* <<setup-repositories,APT or YUM>>
* https://www.elastic.co/downloads/beats/{beatname_lc}[Download page] 
* <<running-on-docker,Docker>>
* <<running-on-kubernetes,Kubernetes>> 
* <<running-on-cloudfoundry,Cloud Foundry>>

[float]
[[set-connection]]
=== Step 2: Connect to the {stack}

include::{libbeat-dir}/shared/connecting-to-es.asciidoc[]

[float]
[[enable-modules]]
=== Step 3: Enable and configure metrics collection modules

{beatname_uc} uses modules to collect metrics. Each module defines the basic
logic for collecting data from a specific service, such as Redis or MySQL. A
module consists of metricsets that fetch and structure the data. Read
<<how-{beatname_lc}-works>> to learn more.

. Identify the modules you need to enable. To see the list of available
<<metricbeat-modules,modules>>, run:
+
--
include::{libbeat-dir}/tab-widgets/list-modules-widget.asciidoc[]
--

. From the installation directory, enable one or more modules. If you accept the
default configuration without enabling additional modules, {beatname_uc}
collects system metrics only.
+
The following command enables the `apache` and `mysql` configs in the
`modules.d` directory:
+
--
include::{libbeat-dir}/tab-widgets/enable-modules-widget.asciidoc[]
--
+
See the <<modules-command>> to learn more about this command. If you are using a
Docker image, see <<running-on-docker>>.

. In the module configs under `modules.d`, change the module settings to match
your environment. See <<module-config-options>> for more about available
settings.

include::{libbeat-dir}/shared/config-check.asciidoc[]

[float]
[[setup-assets]]
=== Step 4: Set up assets

{beatname_uc} comes with predefined assets for parsing, indexing, and
visualizing your data. To load these assets:

. Make sure the user specified in +{beatname_lc}.yml+ is
<<privileges-to-setup-beats,authorized to set up {beatname_uc}>>.

. From the installation directory, run:
+
--
include::{libbeat-dir}/tab-widgets/setup-widget.asciidoc[]
--
+
`-e` is optional and sends output to standard error instead of the configured log output.

This step loads the recommended {ref}/indices-templates.html[index template] for writing to {es}
and deploys the sample dashboards for visualizing the data in {kib}.

[TIP]
=====
A connection to {es} (or {ess}) is required to set up the initial
environment. If you're using a different output, such as {ls}, see
<<load-template-manually>> and <<load-kibana-dashboards>>.
=====

[float]
[[start]]
=== Step 5: Start {beatname_uc}

Before starting {beatname_uc}, modify the user credentials in
+{beatname_lc}.yml+ and specify a user who is
<<privileges-to-publish-events,authorized to publish events>>.

To start {beatname_uc}, run:

// tag::start-step[]
:requires-sudo:
include::{libbeat-dir}/tab-widgets/start-widget.asciidoc[]
:requires-sudo!:
// end::start-step[]

{beatname_uc} should begin streaming metrics to {es}.

[float]
[[view-data]]
=== Step 6: View your data in {kib}

include::{libbeat-dir}/shared/opendashboards.asciidoc[tag=open-dashboards-intro]

include::{libbeat-dir}/shared/opendashboards.asciidoc[tag=open-dashboards]

[float]
=== What's next?

Now that you have your infrastructure metrics streaming into {es}, learn how to
unify your logs, metrics, uptime, and application performance data.

include::{libbeat-dir}/shared/obs-apps.asciidoc[]

:modulename!:

// Add Javascript and CSS for tabbed panels
include::{libbeat-dir}/tab-widgets/code.asciidoc[]
