Search code examples
elasticsearchkibanametricbeat

How fix "Failed to import index-pattern"


When i`m try setup metricbeat dashboard i get error.

i run this command:

metricbeat setup --dashboards

and got this error:

     metricbeat setup --dashboards
    Loading dashboards (Kibana must be running and reachable)
    Exiting: Failed to import index-pattern: Failed to load directory 
    /usr/share/metricbeat/kibana/6/index-pattern:
      error loading /usr/share/metricbeat/kibana/6/index- 
   pattern/metricbeat.json: blocked by: [FORBIDDEN/12/index read-only / allow 
    delete (api)];. Response: {"objects":[{"id":"metricbeat-*","type":"index- 
   pattern","error":{"message":"blocked by: [FORBIDDEN/12/index read-only / 
    allow delete (api)];"}}]}

i try this :

https://benjaminknofe.com/blog/2017/12/23/forbidden-12-index-read-only-allow-delete-api-read-only-elasticsearch-indices/

https://discuss.elastic.co/t/forbidden-12-index-read-only-allow-delete-api/110282

it doesnt help me. in my hard drive im got more then 40% free space i restart elastic, kibana, metricbeat nothing help. all elastick stack installed on one server and metricbeat. also i`m try remove index metricbeat* - not help pls help !


Solution

  • If Kibana has some problems with its storage, it changes its config to read-only mode automatically.

    You should change the block "read_only_allow_delete" from "true" to "false".

    You can check it by using the following command:

    curl -XGET 'localhost:9200/.kibana/_settings'
    

    Note: If it isn't a local machine, you must change "localhost" to your IP address or the resolved hostname.

    There are two ways to fix it, via Kibana dashboard and by using cURL.

    Via Kibana Dashboard

    Go to Kibana dashboard, open Dev Tools, add the block of code which you can see below, and then push the "Run" button

    PUT .kibana/_settings
    {
    "index": {
    "blocks": {
    "read_only_allow_delete": "false"
    }
    }
    }
    

    Via cURL

    you should just execute the command below:

    curl -XPUT "http://localhost:9200/.kibana/_settings" -H 'Content-Type: application/json' -d'
    {
    "index": {
    "blocks": {
    "read_only_allow_delete": "false"
    }
    }
    }'
    

    Good luck!