Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Super Guru

Grafana username and password is stored in a sqlite3 database. One of the way is to reset the password back to admin first and then can be changed in Grafana Dashboard. To do the same, following steps could be used:

1. Logon to the node where Grafana is installed and invoke Grafana sqlite3 database as follows:

# sqlite3 /var/lib/ambari-metrics-grafana/grafana.db

sqlite> select salt, password from user;
pyaUhfDzYg|54c7d1ce2eeaa6000bd84407d0f8ab4663dfa575e0a326bc70dc5cab4b864f6677b21879dbf5e33427c88f9160f744b625bf

sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';

sqlite> .exit

2. Once done, edit Ambari Metrics Server-Configs and update Grafana Password to "admin"

3. Restart the Ambari Metrics Server

4. Access Grafana page using the Quick Links under Ambari Metric Server Dashboard

5. Click on the Grafana Symbol in the top left corner of the screen and Sign-in as admin user with "admin" password

6. Click on Global Users and edit admin user to change the password

7. Once the password is changed, change Grafana Admin password in Ambari Metrics Server-Configs as well

9808-screen-shot-2016-11-28-at-70119-pm.png

Note: If the password is incorrect in Grafana database / Ambari Metrics Server configs, following errors would be observed:

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py", line 64, in <module>
    AmsGrafana().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 219, in execute
    method(env)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 535, in restart
    self.start(env)
  File "/var/lib/ambari-agent/cache/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py", line 46, in start
    create_ams_datasource()
  File "/var/lib/ambari-agent/cache/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana_util.py", line 230, in create_ams_datasource
    (response.status, response.reason, data))
resource_management.core.exceptions.Fail: Ambari Metrics Grafana data source creation failed. POST request status: 401 Unauthorized 
{"message":"Invalid username or password"}
5,690 Views