Monitor if RANCID grabbed all configuration files successfully

From Internetworkpro

Jump to: navigation, search
This page or section provides device configuration instructions
Please note that the information on this page has not been checked for accuracy and is not intended as a replacement to documentation. Please ensure you understand your desired objectives before attempting to apply any examples listed.
See more examples at Category:Configuration

Below is a script which can be scheduled as a cronjob (after rancid runs nightly - before the next day), and it updates an html with a pass string (OK) or a fail string (fail), based on RANCID grabbing all configuration files. If RANCID fails, the monitor will show fail because the html file with have been changed from OK to fail.


#!/bin/bash

#change to rancid logging directory, and grep the current days log file for a rancid success


cd /var/log/rancid
grep "All routers sucessfully completed." *$(date +%Y%m%d)*

#if grep finds the rancid success update a file with a pass or fail string for ipmonitor to check

if [ $? -eq 1 ] ; then
echo "fail" > /var/www/syslog/rancidmonitor.html
elif [ $? -eq 2 ] ; then
echo "fail" > /var/www/syslog/rancidmonitor.html
else
echo "OK" > /var/www/syslog/rancidmonitor.html
fi




#sent OK string to html file so a monitoring application can search for OK
</source>
[[Category:Scripts]][[Category:Bash]]
Personal tools