[rancid] Re: [Fwd: Re: rancid & mysql]

Austin Schutz tex at off.org
Tue Mar 21 22:17:27 UTC 2006


On Tue, Mar 21, 2006 at 01:02:34PM -0700, Justin Grote wrote:
> marju jalloh wrote:
> 
> > Will you break it down a bit? I`m really not a guru
> 
> Everything in rancid is pretty much scripts written in perl, shell, and 
> expect except for one hp-specific binary.
> 
> The primary rancid script (rancid) is a perl script. If you look on line 
> 1539, this is where rancid calls the clogin script which does the actual 
> connection to the router. clogin accepts -u and -p arguments for 
> username and password, so you simply write a few perl lines that do a 
> mysql query like "SELECT username, password FROM rancid WHERE 
> host=$host" to get the username and password combination for the device, 
> and then stick that username and password in as something like -u 
> $username, -p $password.
> 
> If that's too hard, you could simply write a script in any language of 
> your choice that generates a .cloginrc file from the mysql table, and 
> sticks that in the rancid homedir, and then set up a cron job to run the 
> script every 5 minutes.
> 

	The cron job approach seems like the best one, as the generated
file won't change much and there may be times where the database is
unavailable. It's also faster as it doesn't require a database connect
for every device.
	You could also put it in your crontab to run directly before rancid
instead of every 5 mins.

	Austin



More information about the Rancid-discuss mailing list