Search code examples
authenticationyumgrafanaambari

Remove and fresh install of grafana package


I am using ambari to install ambari-metrics-grafana on a centos7 host. Eventually, I lost admin password for grafana. I tried uninstalling, from ambari and host, then re-install. While installation ambari asks for grafana username password. Somehow the new password I provide is failing. What shall I do to make it as a fresh installation with no old records of my password whatsoever? Grafana version is 2.6 Error that occurs is

File "/var/lib/ambari-agent/cache/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py", line 279, in create_grafana_admin_pwd
"PUT request status: %s %s \n%s" % (response.status, response.reason, data))
resource_management.core.exceptions.Fail: Ambari Metrics Grafana password creation failed. PUT request status: 401 Unauthorized 
{"message":"Invalid username or password"}

Solution

  • First, find on which node of ambari cluster, grafana is installed. On that node, run below command.

    # sqlite3 /var/lib/ambari-metrics-grafana/grafana.db
    
    sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
    
    sqlite> .exit
    

    Do below step from ambari web interface

    1. Edit Ambari Metrics Server-Configs and update Grafana Password to "admin"

    2. Restart the Ambari Metrics Server

    Note: if you customize HDP directory during installation and are not able to find "grafana.db", you can do on all node "find / -name "grafana.db" so you will get db file.