RANCID Integration
Installation
Install RANCID and Subversion:
| Text Only | |
|---|---|
1 | |
We need to add a group for rancid to store configs in:
| Text Only | |
|---|---|
1 | |
Add this line:
| Text Only | |
|---|---|
1 | |
Change these two lines:
| Text Only | |
|---|---|
1 2 | |
to:
| Text Only | |
|---|---|
1 2 | |
Run this command to create the folder structure:
| Text Only | |
|---|---|
1 2 | |
Create a .cloginrc file:
| Text Only | |
|---|---|
1 | |
Here is an example that works for Mikrotik devices:
| Text Only | |
|---|---|
1 2 3 4 5 | |
Make sure you have your public key credentials in /var/lib/rancid/.ssh/
Test it out on your router! (In this example, your router is named myrouter)
| Text Only | |
|---|---|
1 | |
Add www-data to the rancid group:
| Text Only | |
|---|---|
1 | |
Observium Integration
Configuration
You can either change the below settings in the config.php or via the web-based configuration accessible from the right hand "cog" menu in the Observium web interface.
Update the Observium config so it knows how to use RANCID:
| Text Only | |
|---|---|
1 | |
Add these lines:
| Text Only | |
|---|---|
1 2 | |
If you're running RANCID v3.x, add the following line :
| Text Only | |
|---|---|
1 | |
Restart apache:
| Text Only | |
|---|---|
1 | |
You should now see a config tab in Observium, with your configs there!
Observium has a script which can generate the router.db config based on what’s in Observium.
| Text Only | |
|---|---|
1 2 3 4 | |
Dump it in the RANCID config file with this command:
| Text Only | |
|---|---|
1 | |
RHEL Installation
Minor
There are some minor differences to be aware of when running RANCID on RHEL. Instead of the configuration files being stored in /var/lib/rancid/, RHEL stores them in /var/rancid/. You may also need to change your RequiredRSASize in your /etc/ssh/ssh_config, as it is updated in RHEL 9.2 to 2048 bits.
For RHEL installations it is suggested that you update to RHEL 9.4. Installation instructions have not been tested for other versions!
Install rancid and subversion:
| Text Only | |
|---|---|
1 | |
We need to add a group for rancid to store configs in:
| Text Only | |
|---|---|
1 | |
Add this line:
| Text Only | |
|---|---|
1 | |
Change these two lines:
| Text Only | |
|---|---|
1 2 | |
to:
| Text Only | |
|---|---|
1 2 | |
Run this command to create the folder structure:
| Text Only | |
|---|---|
1 2 | |
Create a .cloginrc file:
| Text Only | |
|---|---|
1 | |
Here is an example that works for Mikrotik devices:
| Text Only | |
|---|---|
1 2 3 4 5 | |
Make sure you have your public key credentials in /var/lib/rancid/.ssh/
Test it out on your router! (In this example, your router is named myrouter)
| Text Only | |
|---|---|
1 | |
For RHEL installations, Add apache to the rancid group:
| Text Only | |
|---|---|
1 | |
After integration (see "Observium Integration" section), restart apache:
| Text Only | |
|---|---|
1 | |
Automation
We can add this in cron to do this automatically.
If you want rancid to back up daily, then add something like this to cron:
| Text Only | |
|---|---|
1 2 3 | |
Config Search
The RANCID Config Search page allows you to search across all device configurations using regular expressions. Access it from the main menu under Configs > Config Search.
Permissions
Config Search requires user level 7 or above.
Searching
Enter a PCRE (Perl-Compatible Regular Expression) pattern in the search field and submit. Results are grouped by device, with matching lines highlighted and surrounding context lines shown.
Some example patterns:
| Text Only | |
|---|---|
1 2 3 4 | |
Search Options
Search Depth controls which config versions are searched:
- Current Only -- searches the latest config for each device
- All History -- searches all versions in the repository's history (git or svn)
- Last 7/30/90/365 Days -- searches history within the specified time period
Context Lines controls how many lines of surrounding context are shown around each match (0--10 lines).
Multiline enables matching patterns that span multiple lines.
Inverse shows lines that do not match the pattern instead.
Case Sensitive makes the pattern match case-sensitively (by default matching is case-insensitive).
Filtering by Device
Use the device filter dropdown to limit the search to specific devices. Multiple devices can be selected.
Saved Patterns
Frequently used patterns can be saved and loaded from the dropdown next to the search field. Use the Save button to save the current pattern with its options, or the Manage button to open the Saved Patterns page.
Exporting Results
Search results can be exported as TXT or CSV using the export buttons in the results header. Exports include all matching devices and lines.