howto add a ton of users to cacti for use in datacenter?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
spotman
Posts: 15
Joined: Thu Sep 01, 2005 7:22 am

howto add a ton of users to cacti for use in datacenter?

Post by spotman »

Hello,

I am using cacti (8.6f w/ thold) to monitor the bandwidth usage for our network.

We also want to use cacti on the end-user's side because it looks nicer than mrtg and I hope it is easier to maintain. (we have 100+ switches, each port being graphed).

Now on mrtg I have it setup so that you can hyperlink right to the mrtg graph of the specific port you need. Say john doe wants his graph to find out how much bandwidth he is using and he is on switch#12, port #4, I just copy and paste a link to that port into an email to him, and since he is on port#4, he automatically has the port 4 password. Apache controls access to the html page via htaceess, and it has a file name restriction limited to usernames (port1- port40), and a unique password for each port. What this does is it means that if you plug a server into any port in our network, that customer automatically has an mrtg login, and all we have to do is email it to them.

With cacti, seeing as though I have 2000+ port (data sources), and it's setup is so different from mrtg's, I really do not want to have to make 2000 user accounts by hand. I need a user account for each port pretty much and then depending on the port number it needs a specific password. This would enable us to tell a customer to browse to the cacti server http://meter.ourdomain.com, and just login with like username switch12port4 and a password, and voila they can be logged in with permissions to view only their graph on their port.


So with all that said, I am guessing I need to figure out how to write a script that can add 2000 users for me, all with correct usernames, passwords, and permissions. Since cacti's db is so relational, I am unsure where to begin exactly.

If anyone else has tips on how to use cacti in a bandwidth accounting enviroment I would be more than grateful, or any other software for that matter. ... But cacti rawks, and I would really love to use it :)


Cheers
-Spotman
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
axelilly
Posts: 27
Joined: Thu Aug 04, 2005 12:23 pm

Post by axelilly »

Well...that should be pretty easy to do.

Cacti uses a MySQL database to store all of it's operational configs. Therefore, the user information is also stored in a table within that SQL database. All you need to do is write a script that will iterate through all the users you want to create, inserting each one into the table one at a time.
spotman
Posts: 15
Joined: Thu Sep 01, 2005 7:22 am

Post by spotman »

Actually it was easier than I thought, but harder than I thought :)

It would be pretty difficult (for me) to write a script to add the 2000 users considering that each one needed unique permissions based on a graph id, which is based on rra id's, etc. It's not just inserting duplicate users, I guess...

So anyhow, I wrote a new UI to the cacti db, and I made a new user for each switch ~75 switches, and then I redid the login/authentication part of cacti, so that each user logs in, a dropdown menu reads the available ports (data sources queried from the selected host), and then it aks for a password on a per port basis (so customers can't view each other's ports).. and voila... we are good to go :)

Thank you to everyone on this forum for their input! It helps a lot!

If anyone wants any more info on how I did all of the above, I would be glad to share. Cheers
-spotman
User avatar
pirx
Cacti User
Posts: 199
Joined: Tue Feb 10, 2004 10:08 am
Location: Esslingen, Germany

Post by pirx »

spotman wrote: If anyone wants any more info on how I did all of the above, I would be glad to share.
It would be nice if you could post some details (scripts) of what you did!

Thanks, Ralf
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests