Login?

Asked by Dimitry Braznichenko

Any documentation on the functionality of 'Login'? I would think you could login, and then open up saved views, etc. Where can you specify a password for a user? Any info on this? Has anyone gotten this to work?

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
chrismd
Solved:
Last query:
Last reply:
Revision history for this message
Best chrismd (chrismd) said :
#1

Unfortunately the documentation is still a work in progress, and there is no doc specifically on setting up authentication yet. But I can give you a quick explanation that should help until I finish the new docs.

There are two types of authentication you can use, the Django user database or LDAP (and hence Active Directory). If you have an LDAP authentication server I recommend this approach as it is easy to setup. To use LDAP you need to create/modify the file $GRAPHITE_ROOT/webapp/web/local_settings.py. Specifically set "USE_LDAP_AUTH = True" and change all the LDAP_* settings to match your LDAP server configuration. If your local_settings.py file does not contain any LDAP_* settings, then you can copy them from settings.py in the same directory, so long as the settings end up in local_settings.py.

If you do not have an LDAP server, then the only way to authenticate is to create user accounts in the Django user database. This is done through DJango's admin site. The admin site is accessed via http://your-server/admin/ and you login with the admin username and password you setup during installation. You need to go to "Users" and add a new user, then go to "Profiles" and add a Profile for the user you just created. Then log out of the admin site and go back to the main graphite page and you should be able to login as the user you just created. Logged in users can save graphs, save their own views in the CLI ,get their own command history in the CLI, etc.

Let me know if you run into any problems.

Revision history for this message
Dimitry Braznichenko (dimab0) said :
#2

Thanks chrismd, that solved my question.

Revision history for this message
plusbryan (plusbryan) said :
#3

Hi chrismd & Dimitry,
I ran across your post when trying to figure out how to save my graphs (which require a login system first).

Reading your suggestion chrismd, I set up an LDAP server (which is not easy) and tried to get graphite to communicate with it. In the end, I abandoned this as much too hard and was about to give up. Then I figured I should explore the "less preferred method", which in the end was clearly the way to go. Took me 30 seconds:

Step 1: Disable all the LDAP stuff in local_settings.py if you enabled it above. The default is to use the DJango login system.
Step 2: navigate to $GRAPHITE_ROOT/web
Step 3: type 'python manage.py shell', which opens up a python interactive shell
Step 4: type: from django.contrib.auth.models import User
Step 5: then, to create a user: user = User.objects.create_user('username', '<email address hidden>', 'mypassword')
Step 6: then, type: user.save()
Step 7: repeat 5-6 for more users
Step 8: log in from the graphite window and enjoy saving! also, try editing your profile and enabling the 'advanced features' -- all I found was the '*' feature, but it's awesome!

documented this all on my blog: http://www.xobni.com/bryan