View previous topic :: View next topic |
Author |
Message |
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Fri Mar 14, 2008 10:01 am Post subject: Need help setting-up racid web interface |
|
|
Hi all,
I am trying to setup Rancid to automatically back-up cisco devices & stuff, and I would really like to have web-based interface to add / edit etc devices...
On gentoo wiki there is a guide (http://gentoo-wiki.com/HOWTO_Rancid#Adding_A_Web_Interface) but the last section is outdated - it looks like viewcvs ins replaced by viewvc package, and also the files have changed / are diffrent...
Can anyone assist me in the configuration, just the last web-based part?
Thanks,
brm |
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Fri Mar 14, 2008 1:00 pm Post subject: |
|
|
Depending on the rancid version you are using you can have Subversion as an CVS system too. With Subversion you can use WebSVN as web interface. I have this running here (Rancid + Subversion) and it's all working very well. So I can help you in case you choose SVN. _________________ Hello 911? How are you? |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Fri Mar 14, 2008 1:13 pm Post subject: |
|
|
Hi,
thank you very much for your reply - if it is not too much trouble I would really appreciate any help you can give.....
rancid version:
I also have subversion installed, with the following USE flags:
Code: | [ebuild R ] dev-util/subversion-1.4.6 USE="apache2 berkdb nls perl python -bash-completion -debug -doc -emacs -extras -java -nowebdav -ruby -svnserve -vim-syntax" 0 kB |
I guess I should recompile it with svnserve flag enabled? |
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Fri Mar 14, 2008 4:21 pm Post subject: |
|
|
First re-emerge subversion with svnserve flag enabled. Then you need rancid-2.3.2a7 which has SVN support. Setup rancid as you already have done but take a look at the README which tells you how to activate SVN.
With RANCID and the SVN repository set up properly install websvn. If you need help configuring apache/websvn just say so. _________________ Hello 911? How are you? |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Fri Mar 21, 2008 9:53 am Post subject: |
|
|
Hi,
sorry was out of the office a lot and didn't have time to deal with this... :/
Anyway, I have setup apache with right use flags, I have subversion up and running and websvn working.
Now I need to create SVN repository with rancid and use it in websvn config - this is where i have come upon a problem... Can you tell me how-to activate SVN support on rancid...? I only have CVS as far as I can tell...
brm
EDIT: Ok, looks like you activate the SVN just with modifying the rancid conf file So, rancid is using the SVN now, but I still don't see anything in websvn....
Here is the log file:
Code: | Trying to get all of the configs.
All routers sucessfully completed.
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/var/rancid/networking' is not a working copy
ending: Fri Mar 21 11:06:03 CET 2008 |
|
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Fri Mar 21, 2008 10:28 am Post subject: |
|
|
myha wrote: |
Here is the log file:
Code: | Trying to get all of the configs.
All routers sucessfully completed.
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/var/rancid/networking' is not a working copy
ending: Fri Mar 21 11:06:03 CET 2008 |
|
Which log file? Did you follow the readme how to set up rancid? Did you already initialise the repository (running rancid-cvs)? What does your websvn config look like? _________________ Hello 911? How are you? |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Fri Mar 21, 2008 10:56 am Post subject: |
|
|
Hi,
this is the rancid log for networking group:
Code: | rancid@gprserver /var/rancid/logs $ ls -l
total 8
-rw-r----- 1 rancid rancid 467 Mar 21 11:16 networking.20080321.111604
-rw-r----- 1 rancid rancid 209 Mar 21 11:16 packet.20080321.111638
rancid@gprserver /var/rancid/logs $ |
I executed the rancid-cvs...
Here are the configs (btw I tried quite some configurations but none worked...):
Code: | cat /var/www/localhost/htdocs/websvn/include/config.php | grep -v //
<?php
$config->addRepository('rancid', '/var/rancid/networking/CVS/');
$config->setTemplatePath("$locwebsvnreal/templates/calm/");
$config->setMinDownloadLevel(2);
set_time_limit(0);
$config->expandTabsBy(8);
?> |
Code: | rancid@gprserver /var/www/localhost/htdocs/websvn/include $ cat /etc/rancid/rancid.conf | grep -v "#"
TERM=network;export TERM
umask 027
TMPDIR=/tmp; export TMPDIR
BASEDIR=/var/rancid; export BASEDIR
PATH=/usr/rancid/bin:/usr/bin:/usr/sbin:/bin:.:/usr/local/bin:/usr/bin; export PATH
CVSROOT=$BASEDIR/CVS; export CVSROOT
LOGDIR=$BASEDIR/logs; export LOGDIR
RCSSYS=svn; export RCSSYS
OLDTIME=4; export OLDTIME
LIST_OF_GROUPS="networking packet"
FILTER_PWDS=YES; export FILTER_PWDS
NOCOMMSTR=YES; export NOCOMMSTR
rancid@gprserver /var/www/localhost/htdocs/websvn/include $ |
in websvn I see the repository, but everything is empty.... |
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Fri Mar 21, 2008 2:05 pm Post subject: |
|
|
myha wrote: |
Code: |
$config->addRepository('rancid', '/var/rancid/networking/CVS/');
|
|
How about?
Code: |
$config->addRepository('rancid', 'file:///var/rancid/<repositoryname>');
|
_________________ Hello 911? How are you? |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Sat Mar 22, 2008 12:39 am Post subject: |
|
|
Hi,
tried that also:
Code: | $config->addRepository('rancid', 'file:///var/rancid/networking'); |
Code: | gprserver networking # ls -la
total 16
drwxr-xr-x 4 rancid rancid 256 Mar 22 01:05 .
drwxr-xr-x 6 rancid rancid 152 Mar 21 10:30 ..
-rwxr-xr-x 1 rancid rancid 47 Mar 14 06:00 .cvsignore
drwxr-xr-x 2 rancid rancid 128 Mar 20 16:02 CVS
drwxr-xr-x 3 rancid rancid 168 Mar 22 01:05 configs
-rwxr-xr-x 1 rancid rancid 55 Mar 20 16:01 router.db
-rw-r----- 1 rancid rancid 43 Mar 22 01:05 routers.all
-rw-r----- 1 rancid rancid 0 Mar 22 01:05 routers.down
-rw-r----- 1 rancid rancid 43 Mar 22 01:05 routers.up
gprserver networking # |
|
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Sat Mar 22, 2008 10:18 am Post subject: |
|
|
Does this work?
Code: | $config->addRepository('rancid', 'file:///var/rancid/networking/CVS'); |
_________________ Hello 911? How are you? |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Sun Mar 23, 2008 12:19 pm Post subject: |
|
|
Hi,
finally figured it out...
In rancid config file I noticed the following:
Code: | Select which RCS system to use, "cvs" (default) or "svn". Do not change this after CVSROOT has been created with rancid-cvs. Changing between these requires manual conversions. |
So I removed everything in /var/rancid/ and executed ~/bin/rancid-cvs again - It created revision 1 and after that I was able to see files, configs etc in websvn....
btw, for repository I used:
Code: | $config->addRepository('rancid', 'file:///var/rancid/CVS'); |
which seem to work.
One additional question - is it possible to make rancid just to do backups of running conf, not also all other commands that it executes (sh diag, sh version,....)
Thanks for your help, you pointed me in the right way... Will update the gentoo rancid wiki with subversion and websvn for rancid.
brm |
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Tue Mar 25, 2008 6:39 am Post subject: |
|
|
For Cisco switches with IOS running take a look at the file in <rancid_home>/bin/rancid at the line 1422. There are commands listed which are exectued on selected switches and parsed by this tool. I guess if you comment out the not needed ones you might be able to have only the running config checked out - hence comment out all but 'show running-config'. _________________ Hello 911? How are you? |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Fri Jul 16, 2010 7:38 am Post subject: |
|
|
i have a question
rancid runs an takes the configs from my devices
but where i can take options that rancid takes the configs an a specific time period
thanks for help |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Sun Jul 18, 2010 4:33 pm Post subject: |
|
|
Cron? |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Mon Jul 19, 2010 10:19 am Post subject: cronjob |
|
|
thx for the tipp with the cronjob!!!!
but i have a other problem
i want that rancid refresh every day at 6am and at 10pm
and so i have wrote for the cron:
0 6,22 *** /var/lib/rancid/.scripts/routers.sh > /dev/null 2>&1
and when i want to save the vim i get this error:
crontab: installing new crontab
"/tmp/crontab.CDripp/crontab":0: bad month
errors in crontab file, can't install.
whats wrong there
nedd help pls |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Mon Jul 19, 2010 11:24 am Post subject: |
|
|
Spaces are missing between day / month / weekday:
Code: | 0 6,22 * * * /var/lib/rancid/.scripts/routers.sh > /dev/null 2>&1 |
|
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Tue Jul 20, 2010 7:17 am Post subject: |
|
|
myha i need again your help
the cron that i have wrote in the vim is not the right one to refresh rancid
i also tried it with
0 6,22 * * * /home/rancid/bin/rancid-run
but rancid don´t refresh and takes the config from my devices
on this time rancid should take the configs and refresh at 6am and 10pm
maybe you can show me the righht one
pls
thanks addit |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Tue Jul 20, 2010 1:05 pm Post subject: |
|
|
Have you tried to run the command manually, without cron?
Code: | /home/rancid/bin/rancid-run |
Check also the logs for possible errors etc (/var/rancid/log in my case, check rancid.conf or more /etc/rancid/rancid.conf | egrep -i "LOGDIR|BASEDIR" ), you should see something like this if all is ok, otherwise you will see the errors:
Code: |
starting: Tue Jul 20 15:00:47 CEST 2010
Trying to get all of the configs.
All routers sucessfully completed.
At revision 894.
Sending configs/csw
Transmitting file data .
Committed revision 895.
ending: Tue Jul 20 15:01:43 CEST 2010
|
Please note also that if nothing changes on routers no update will be done on rancid web interface. If you want to make backups hourly wou can make some small bash script using clogin to do that for you, read the clogin man for more details. |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Wed Jul 21, 2010 11:04 am Post subject: |
|
|
first i have shut down an interface from a device, and then i have tried it manually(with rancid-run) but it doesn´t works
then i have checkt the logs and i got this error:
Trying to get all of the configs.
fw-at-klu-sr1-101.addit.local clogin error: Error: no enable password for fw-at-klu-sr1-101.addit.local in /home/rancid/.cloginrc.
fw-at-klu-sr1-101.addit.local: missed cmd(s): dir /all slavedisk2:,show rsp chassis-info,dir /all sec-slot2:,show diag,dir /all disk1:,show gsr chassis,dir /all sec-nvram:,$
fw-at-klu-sr1-101.addit.local: End of run not found
but last week i get also this error because in the .cloginrc was wrote in the place of the IP the device name
so i correct it and wrote the IP there
and then it runs
maybe you find an error there
thats my .cloginrc
add user * {rancid}
add password 10.140.1.1 {7oE9kP} {7oE9kP}
add password 10.140.1.230 {7oE9kP} {7oE9kP}
add password 10.140.1.231 {7oE9kP} {7oE9kP}
add password 10.140.0.1 {7oE9kP} {7oE9kP}
add password 10.140.0.232 {7oE9kP} {7oE9kP}
add password 10.140.0.231 {7oE9kP} {7oE9kP}
add password 10.140.0.230 {7oE9kP} {7oE9kP}
add password * {7oE9kP}
add method * ssh telnet
#add autoenable * 1
#
#info für die IP´s und den dazugehörigen Namen der Devices
#Device Name:fw-at-klu-sr1-101.addit.local appropriate IP:10.140.1.1
#Device Name:sa-at-klu-sr1-101.addit.local appropriate IP:10.140.1.230
#Device Name:sa-at-klu-sr0-101.addit.local appropriate IP:10.140.1.231
#Device Name:fw-at-vih-b01-201.addit.local appropriate IP:10.140.0.1
#Device Name:sa-at-vih-b01-201.addit.local appropriate IP:10.140.0.232
#Device Name:sa-at-vih-b02-001.addit.local appropriate IP:10.140.0.231
#Device Name:sa-at-vih-b02-401.addit.local appropriate IP:10.140.0.230
#
# |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Wed Jul 21, 2010 2:44 pm Post subject: |
|
|
thanks for your help myha
i have changed the .cloginrc
and now it works
rancid refreshs all devices apart one
and when i want to logon on this device i get this error
rancid@rzklunoms:~/var/rancid/Villach$ clogin 10.140.0.232
10.140.0.232
spawn telnet 10.140.0.232
Trying 10.140.0.232...
telnet: Unable to connect to remote host: Connection refused
Error: Connection Refused (telnet): 10.140.0.232
whats wrong there, or in what file i have a error, or to change something
thx addit |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Wed Jul 21, 2010 7:15 pm Post subject: |
|
|
This is not a rancid issue. I guess you cannot connect through telnet directly also (try from the same machine)? Maybe you use ssh to connect? |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Thu Jul 22, 2010 9:01 am Post subject: |
|
|
thx for help
but one thing i want to know
if rancid refresh and i look at the configs there is a .new past the devicename
why wats the reason for it
-rw-r----- 1 rancid rancid 40675 Jul 21 14:45 fw-at-klu-sr1-101.addit.local
-rw-r----- 1 rancid rancid 0 Jul 22 15:13 fw-at-klu-sr1-101.addit.local.new
-rw-r----- 1 rancid rancid 16765 Jul 22 14:09 sa-at-klu-sr0-101.addit.local
-rw-r----- 1 rancid rancid 16765 Jul 22 15:09 sa-at-klu-sr0-101.addit.local.new
-rw-r----- 1 rancid rancid 16041 Jul 22 14:09 sa-at-klu-sr1-101.addit.local
-rw-r----- 1 rancid rancid 16041 Jul 22 15:09 sa-at-klu-sr1-101.addit.local.new |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Fri Jul 23, 2010 12:36 pm Post subject: |
|
|
thx for help
but i have another an error
when i refresh with rancid, i get this error in the logs
Error: couldn't read file "/root/.cloginrc": illegal operation on a directory
pls tell me what i have to change
thx addit |
|
Back to top |
|
|
myha Apprentice
Joined: 16 Sep 2005 Posts: 152 Location: Ljubljana, Slovenia
|
Posted: Sat Jul 24, 2010 10:46 am Post subject: |
|
|
Use right user or specify the .clogin if runing with root. |
|
Back to top |
|
|
addit n00b
Joined: 16 Jul 2010 Posts: 11
|
Posted: Wed Jul 28, 2010 8:28 am Post subject: |
|
|
thx for help myha
Last edited by addit on Wed Jul 28, 2010 11:05 am; edited 2 times in total |
|
Back to top |
|
|
|