ConfigStore Plugin

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

ConfigStore Plugin

Post by chadd »

ConfigStore is a plugin for backing up device configurations - based on the routerconfigs plugin. It is under development at the moment, but at a point that I think it could be useful.

Like with anything, you should make backups, be careful, etc. before installing. I make no warranty.

This plugin uses the PIA 2.x, so just untar, ungzip the file to your plugin directory and go to Plugin Management.

For further instructions please read the README file included in the tar ball. Better documentation will follow shortly.

This plugin is under active development, so fixes/features will be coming soon.

For now please post back to this thread if you have questions, problems, etc. I will work on getting a site to put releases on in the future, but that will be a ways off.

Have fun!

-chadd.
Attachments
configstore-v0.7.tar.gz
ConfigStore v0.7
(104.93 KiB) Downloaded 1116 times
Last edited by chadd on Mon Nov 14, 2011 2:07 pm, edited 16 times in total.
User avatar
TheWitness
Developer
Posts: 16997
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Dont forget to post to the docs once its stable.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Sure thing. I did put some notes in the readme file, but documentation will be forthcoming. Thanks.

-chadd.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

The last file had a bug, so I fixed it and tried to upload the new one, but keep getting a: No post mode specified message.

I will post the fixed version when the forum starts cooperating again. Sorry..
Marcelo
Posts: 48
Joined: Tue May 02, 2006 4:46 pm

Post by Marcelo »

Excelent work! if you need some betatester, feel free to contact me.
I have equipment from Cisco, Juniper, Arris, Nortel.
cya.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

I have made some corrections, so hopefully some of you can give it a try and let me know what you think.

-chadd.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

If you downloaded that last one, it had an error in the logging class. I fixed it and uploaded a new file. There will be other corrections coming this morning. Stay tuned...
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Found out that I did not account for not having to use a normal password, and an enable password when doing terminal logins. Now if you have a user set up with the privilege level to do enabled commands at first login, it should work. Just use the password field in the account form, and leave the enable password field blank if that is your case.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Marcelo wrote:Excelent work! if you need some betatester, feel free to contact me.
I have equipment from Cisco, Juniper, Arris, Nortel.
cya.
Could certainly use a beta tester.
Have decided right now not to support Nortel. Most importantly because the config (at least on the switches we have) is binary. I have not looked into ways of making it text. Two, we are getting rid of them, and I don't know for sure, but I think they are defunct..
As for Juniper and Arris, I don't have either of those vendors equipment to test on. If you would like to send me info on them (login process, backup process, snmp mibs, etc.) I could try to do something if I get some time. The only issue is that you would have to do the testing. A better plan would be for you to add that functionality and post back the files ;). It is quite easy to add new vendor types (not as easy as I would like, but still quite easy). If you want to know what files to edit/create, let me know I will make a little recipe.

Anyway, thanks.

-chadd.
eternal
Cacti User
Posts: 68
Joined: Thu Dec 14, 2006 4:38 pm
Location: Kingsport TN
Contact:

Post by eternal »

For nortel routers look at bcc
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

eternal wrote:For nortel routers look at bcc
Sorry, I don't want to seem callus, but I really can't spend the time on getting Nortel devices to work. I think that even if I did, the config backup you have would not be able to be re-uploaded to a device for recovery. It would only serve as a template for the manual configuration of a device. Which may be very useful to people, but not to my current employer (as we would just replace it with a different vendors equipment).

If someone wants to work on backups for Nortel devices, using this plugin, I would be happy to answer any questions they might have in the process of writing the code.

The easiest way to get started (and this goes for any new currently unsupported equipment) would be as follows:

1.) Change code starting on line 98 of the configstore_devices.php file shown here:

"devicetype" => array(
"method" => "drop_array",
"friendly_name" => "Device Type",
"description" => "Choose the type of device.",
"value" => "|arg1:devicetype|",
"default" => 0,
"array" => array(1 => 'Cisco-IOS', 2 => 'Foundry'),
),
Add your new device type to the array, so it shows up in the drop down.

2.) Edit the functions.php file to detect your new device type and call the new php file you are going to create. Below is the section of code you need to edit (around line 84):

// Cisco-IOS device type
if ($device['devicetype'] == '1') {
if(!file_exists($config['base_path'] . '/plugins/configstore/lib/cisco-ios.php')) {
return false;
} else {
include_once($config['base_path'] . '/plugins/configstore/lib/cisco-ios.php');
$backup_results = cisco_ios_get_config($device);
}
// Foundry device type
} elseif ($device['devicetype'] == '2') {
if(!file_exists($config['base_path'] . '/plugins/configstore/lib/foundry.php')) {
return false;
} else {
include_once($config['base_path'] . '/plugins/configstore/lib/foundry.php');
$backup_results = foundry_get_config($device);
}
} else {
return false;
}

As you can infer, your new device type will be 3 and you will include a new file you are about to create to do the actual backup of the device.

3.) Create the new backup script and put it in the "lib" directory. You can just make a copy of one of the .php files currently in there (like cisco-ios.php or foundry.php) and modify it for your purposes. The expect scripts in the "lib" directory I am just using to do the terminal logins, and return the output to the backup script (cisco-ios.php or foundry.php). This script you create just has to return the following array back to the functions.php script:

$backup_results = array('device' => $device['id'],
'btime' => $t,
'directory' => $dir,
'filename' => $filename,
'config' => $data,
'lastchange' => $lastchange,
'username' => $lastuser,
'hostname' => $hostname,
);
It doesn't matter how you get this information, just that it gets sent back to the functions.php script in this format.

And that should be it. You should have support for your new device. The scripts I have included so far (cisco-ios.php and foundry.php) support all the different methods of backing up one of these devices. Your script does not have to - it only needs to support the method you would like to use. The "configstore_accounts" script should be able to accommodate your authentication requirements. If not, that can be changed too.

Hope this helps someone, and don't be afraid to ask me questions. I may not be able to answer them, but I will try. Good luck.

-chadd.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

I have made some further corrections and uploaded a new file. These are:

- Actually saving the debug on backup failure (not sure how I missed that ;).
- increasing the timeout to 30 seconds on the terminal logins (expect scripts). Some of my devices needed more than 10 seconds to complete.

-chadd.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Just upgraded to Cacti version 0.8.7g and Plugin Architecture Version 2.8, and everything appears to be working fine.
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

Post by zgamer »

chadd wrote: Could certainly use a beta tester.
Have decided right now not to support Nortel. Most importantly because the config (at least on the switches we have) is binary...
Any of the newer Avaya/Nortel (25xx,45xx,55xx,56xx, and 8xxx) switches also support ascii config management when running newer code.
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

zgamer wrote:
chadd wrote: Could certainly use a beta tester.
Have decided right now not to support Nortel. Most importantly because the config (at least on the switches we have) is binary...
Any of the newer Avaya/Nortel (25xx,45xx,55xx,56xx, and 8xxx) switches also support ascii config management when running newer code.
If you post the methods (ssh, telnet, scp, tftp, scpserver, snmp, etc.) that you'd like, and the data I need to write the code (login proceedure capture, mibs, etc.) I will give the code a try - and you can test it for me, as I have no Avaya/Nortel equipment to test on.. Let me know, and I will try to help.

-chadd.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests