Support Needed on Metricbeat setup issue

Hi all, below is my metricbeat.yml file.

Error msg when running "metricbeat setup": Did not find expected key.

` ###################### Metricbeat Configuration Example #######################

# This file is an example configuration file highlighting only the most common
# options. The metricbeat.reference.yml file from the same directory contains all the
# supported options with more comments. You can use it as a reference.
#
# You can find the full configuration reference here:
# https://www.elastic.co/guide/en/beats/metricbeat/index.html

# ==========================  Modules configuration ============================

metricbeat.config.modules:
  # Glob pattern for configuration loading
  # path: ${path.config}/modules.d/*.yml
  path: $/etc/metricbeat/metricbeat.yml

  # Set to true to enable config reloading
  reload.enabled: false

  setup.dashboards.enabled: true  

  # Period on which files under path should be checked for changes
  #reload.period: 10s

#==================== Elasticsearch template setting ==========================

setup.template.settings:
  index.number_of_shards: 1
  index.codec: best_compression
  #_source.enabled: false

#================================ General =====================================

# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
#name:

# The tags of the shipper are included in their own field with each
# transaction published.
#tags: ["service-X", "web-tier"]

# Optional fields that you can specify to add additional information to the
# output.
#fields:
#  env: staging


#============================== Dashboards =====================================
# These settings control loading the sample dashboards to the Kibana index. Loading
# the dashboards is disabled by default and can be enabled either by setting the
# options here, or by using the `-setup` CLI flag or the `setup` command.
#setup.dashboards.enabled: false

# The URL from where to download the dashboards archive. By default this URL
# has a value which is computed based on the Beat name and version. For released
# versions, this URL points to the dashboard archive on the artifacts.elastic.co
# website.
#setup.dashboards.url:

#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: ["10.0.106.144:5601"]
  username: "admin"
  password: "admin"
 
  setup.kibana.protocol: "http"
  setup.kibana.path: /kibana
 # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

#============================= Elastic Cloud ==================================

# These settings simplify using metricbeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
#setup.kibana.host: "10.0.106.144:5601"
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

#================================ Outputs =====================================

# Configure what output to use when sending the data collected by the beat.

#-------------------------- Elasticsearch output ------------------------------
#output.elasticsearch:
  #  Array of hosts to connect to.
 hosts: ["10.0.106.144:9200"]

  # Optional protocol and basic auth credentials.
 protocol: "https"
 username: "selkslarc"
 password: "P@ssword"

#----------------------------- Logstash output --------------------------------
output.logstash:
  # The Logstash hosts\
  hosts: ["10.0.106.144:5044"]
  bulk_max_size: 1024
  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #  ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  # ssl.key: "/etc/pki/client/cert.key"

#================================ Procesors =====================================

# Configure processors to enhance or manipulate events generated by the beat.

processors:
  - add_host_metadata: ~
  - add_cloud_metadata: ~

#================================ Logging =====================================

# Sets log level. The default log level is info.
# Available log levels are: error, warning, info, debug
logging.level: debug

# At debug level, you can selectively enable logging only for some components.
# To enable all selectors use ["*"]. Examples of other selectors are "beat",
# "publish", "service".
#logging.selectors: ["*"]

#============================== Xpack Monitoring ===============================
# metricbeat can export internal metrics to a central Elasticsearch monitoring
# cluster.  This requires xpack monitoring to be enabled in Elasticsearch.  The
# reporting is disabled by default.

# Set to true to enable the monitoring reporter.
#xpack.monitoring.enabled: false

# Uncomment to send the metrics to Elasticsearch. Most settings from the
# Elasticsearch output are accepted here as well. Any setting that is not set is
# automatically inherited from the Elasticsearch output configuration, so if you
# have the Elasticsearch output configured, you can simply uncomment the
# following line.
#xpack.monitoring.elasticsearch:`

Please format your config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

Any idea why this error occurring ?

Please show the entire error, including any commands you are running when you are getting the error.

@skyluke.1987, are you trying to setup dashboard for logstash output?
Below is the full command to setup same:

metricbeat setup -e \
  -E output.logstash.enabled=false \
  -E output.elasticsearch.hosts=['localhost:9200'] \
  -E output.elasticsearch.username=metricbeat_internal \
  -E output.elasticsearch.password=YOUR_PASSWORD \
  -E setup.kibana.host=localhost:5601

Kindly let me know if you have any other query.
Thanks.

@Tek_Chand Yes, I am trying to setup the dashboard for logstash to be able to display some visualization on Kibana dashboards. May I know are those the values need to be added onto the matricbeat.yml file? Thanks

And when I try to run this "metricbeat setup -e" command, it shows me .. Error: Exiting" Error loading config file: yaml: line 100" did not find expected key.

Which refers to the Host IP: which currently i'm using ["10.x.xxx.xxx:9200"] for the input. Is there anything wrong with this?

@skyluke.1987,

You need to enable kibana setup in metricbeat.yml file. You can refer the below configuration:

#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "your_kibana_server_IP:5601"

Then you need to run the below all commands. You need to use \ (backslash) also after every command:

metricbeat setup -e \
  -E output.logstash.enabled=false \
  -E output.elasticsearch.hosts=['your_elasticsearch_server_ip:9200'] \
  -E setup.kibana.host=your_kibana_server_ip:5601

Kindly let me know if you still face any issue.

Thanks.

Ya I followed your steps. .... now it comes with this error : Exiting : error loading config file: yaml: line 100: did not find expected key.

Any idea how do we resolve this issue?

@skyluke.1987,

Can you please share your metricbeat.yml configuration file on which you are running these commands?

Also please share your nginx configuration file.

Your kibana server should be reachable from the server on which you are running these commands.

You can run the below commands to check kibana server is reachable or not from your server on which you are running these commands:

telnet your_kibana_server_ip 443

Thanks.

Hi, on the very first post, I did share a .yml file. That is the metricbeat.yml file.
I am trying to install all the SELKs on the same server. I dont think I can telnet within the same server? As for now, after issuing the telnet command, it shows unable to connect to the remote host: Connection refused.

@skyluke.1987,

correction in my previous post

use the below command:

telnet your_kibana_server_ip 5601

If above command is not working then this is the issue and you need to fix it.

Note: Run the above command from the system using you are trying to setup kibana dashboard. Its one time process.

Hi, I am able to run this command and get connected. What could be the possible issue.

This 443 is not able to connect is it due to firewall or configuration issue ?

@skyluke.1987

Its not required and your kibana server is reachable from that system. So issue is somewhere else.

Are you getting that error at very first command i,e:

metricbeat setup -e \

With the "" symbol, there is no error just pending user input. If is without that symbol it will prompt "Error loading config file: yaml. line 100: did not find expected key.

Where need to use these "" symbol? Please update here so if anyone else face this issue it will might be helpful.

Thanks.

Opsss sorry for the unclear reply. What I meant is as bellow:

metricbeat setup -e \ (This is fine)
metricbeat setup -e (This will show error: Error loading config file : Yaml : line 100 : did not find expected key

@skyluke.1987,

I told you in my earlier post that you need to use \ (backslash) after every command.

But now good to hear that your problem is fixed.

Thanks.