RANCID monitors a router’s (or more generally a device’s) configuration, including software and hardware (cards, serial numbers, etc) and uses CVS (Concurrent Version System) or Subversion to maintain history of changes.
RANCID does this by the very simple process summarized here:
login to each device in the router table (router.db),
run various commands to get the information that will be saved,
cook the output; re-format, remove oscillating or incrementing data,
email any differences from the previous collection to a mail list,
and finally commit those changes to the revision control system
Here we are using two router with diff user& pass<
192.168.70.1 router_admin cisco1
192.168.70.2 router_admin1 cisco2
Install RANCID
yum install expect -y |
Download & install
wget ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.4.tar.gz tar zxvf rancid-2.3.4.tar.gz ./configure make make install |
RANCID configuration
vi /usr/local/rancid/etc/rancid.conf LIST_OF_GROUPS="isp" |
create config file in user going to execute rancid, here you may create dedicated user for rancid. I am using nagios as its used for all other monitoring.
cp cloginrc.sample /home/nagios/.cloginrc chmod 0600 /home/nagios/.cloginrc chown nagios: /home/nagios/.cloginrc |
Modify aliases to receive email alert, rancid will send email alert with change diff to admin emailid.
vi /etc/aliases rancid-admin-isp: dhaval@linuxreaders.com newaliases |
change permission for nagios user
chown nagios: /usr/local/rancid/var/ -R |
Run following commands as rancid user (here nagios)
su nagios |
only for the new installation / first time, to create cvs repo.
/usr/local/rancid/bin/rancid-cvs |
Modify cloginrc file for specific router user & pass, here you can defile credentials for every router.
vi ~/.cloginrc add user 192.168.70.1 router_admin add password 192.168.70.1 cisco1 add autoenable 192.168.70.1 1 add user 192.168.70.2 router_admin1 add password 192.168.70.2 cisco2 add autoenable 192.168.70.2 1 #If you are using fqdn with same user & pass, following can be used. add user *.ipguide.info tux add password *.ipguide.info {tux} add autoenable *.ipguide.info 1 |
Define router with its manufacturer & status
cat /usr/local/rancid/var/isp/router.db 192.168.70.1:cisco:up 192.168.70.2:cisco:up |
# you can schedule this command to run every day / after few hours
/usr/local/rancid/bin/rancid-run |
while running above command logs will be generated in /usr/local/rancid/var/logs which you can use.
If you find error in logs, you may use following command to diagnose.
/usr/local/rancid/bin/clogin 192.168.70.1 |
Install ViewVC
Dependency
yum install rcs -y |
extract package e.g viewvc-1.2-dev-20100901.tar.gz tar zxvf viewvc-1.2-dev-20100901.tar.gz cd viewvc-1.2-dev-20100901 ./viewvc-install #use default path |
cp /usr/local/viewvc-1.2-dev/bin/cgi/viewvc.cgi /var/www/cgi-bin/ chown apache: /var/www/cgi-bin/viewvc.cgi vi /usr/local/viewvc-1.2-dev/viewvc.conf ##below [general] cvs_roots = cvsroot: /usr/local/rancid/var/CVS, |
now you’ll be able to access from http://x.x.x.x/cgi-bin/viewvc.cgi
