Monitor mupltiple clients

Hello, I am new to Elastic and I got deployment ina network where I have:
1 elastic server ( elastic,kibana,metricbeat... , all on a single instance)
15 LAMP servers.
Idea is to monitor them using kibana on the elastic server.

I am trying to set metricbeat monitoring for MySQL to monitor all 15 servers, however, I am stuck on one.
I can monitor LAMP1 using:

    # Module: mysql
    # Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-mysql.html

    - module: mysql
      #metricsets:
      #  - status
      #  - galera_status
      period: 10s

      # Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
      # or "unix(/var/lib/mysql/mysql.sock)/",
      # or another DSN format supported by <https://github.com/Go-SQL-Driver/MySQL/>.
      # The username and password can either be set in the DSN or using the username
      # and password config options. Those specified in the DSN take precedence.
      hosts: ["metricbeat:password@tcp(10.0.0.1:3306)/"]

      # Username of hosts. Empty by default.
      #username: root

      # Password of hosts. Empty by default.
      #password: secret

however, I have issues adding additional clients.
I attempted to add multiple hosts lines:

    hosts: ["metricbeat:password@tcp(10.0.0.1:3306)/"]
    hosts: ["metricbeat2:password2@tcp(10.0.0.2:3306)/"]
    ...

/etc/metricbeat/modules.d/mysql.yml into mysql2.yml with diffrent host, however no luck.

There is no documentation I can find on multiple hosts, can someone please explain this to me? Thank you

Hi @stefan-cplanet,

the hosts key is already an array in which you can specify multiple hosts:

    - module: mysql
      #metricsets:
      #  - status
      #  - galera_status
      period: 10s

      # Host DSN should be defined as "user:pass@tcp(127.0.0.1:3306)/"
      # or "unix(/var/lib/mysql/mysql.sock)/",
      # or another DSN format supported by <https://github.com/Go-SQL-Driver/MySQL/>.
      # The username and password can either be set in the DSN or using the username
      # and password config options. Those specified in the DSN take precedence.
      hosts:
        - "metricbeat:password@tcp(10.0.0.1:3306)/"
        - "metricbeat2:password2@tcp(10.0.0.2:3306)/"

Does that work for you?

Hi, thank you for answer. I don't get an error but I still only have 1 dasboard. How do I see data of each specific server in Kibana? thank you

Yes, the dashboard in its unfiltered state would contain the data from all hosts. You can filter the dashboard using either the KQL query bar at the top or the structured filters beneath that bar:

image

You can either adjust these filters on-demand or clone and save the filtered dashboards with individual names for easy access. Alternatively you can use the "saved queries" feature to easily switch between filters:

image