ConfigStore Plugin

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
matexoman
Posts: 5
Joined: Mon Mar 23, 2009 11:07 am

Re: ConfigStore Plugin

Post by matexoman »

we have some C3750 stacks and we cant get the config.

Configstore debug:

/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.2.111 i 1 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.3.111 i 4 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.4.111 i 1 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.5.111 a 10.111.255.230 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.6.111 s 10.39.255.21.cfg SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 1 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 6 FAILED

If we do it by hand :

/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 6
Error in packet.
Reason: (badValue) The value given has the wrong type or length.
Failed object: iso.3.6.1.4.1.9.9.96.1.1.1.1.14.111

Equipment version:

001_cat3750_03>sh ver
Cisco IOS Software, C3750 Software (C3750-ADVIPSERVICESK9-M), Version 12.2(25)SED1, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Tue 22-Nov-05 23:37 by yenanh

Any idea ?
Last edited by matexoman on Mon Feb 14, 2011 11:53 am, edited 1 time in total.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

matexoman wrote:we have some C3750 stacks and we cant get the config.

Configstore debug:

/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.2.111 i 1 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.3.111 i 4 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.4.111 i 1 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.5.111 a 10.111.255.230 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.6.111 s 10.39.255.21.cfg SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 1 SUCCESS
/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c <rwcommunity> 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 6 FAILED

If we do it by hand :

/usr/bin/snmpset -r 3 -t 2000 -Oqv -v 1 -c rwo08saki 10.39.255.21:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 6
Error in packet.
Reason: (badValue) The value given has the wrong type or length.
Failed object: iso.3.6.1.4.1.9.9.96.1.1.1.1.14.111

Equipment version:

001_cat3750_03>sh ver
Cisco IOS Software, C3750 Software (C3750-ADVIPSERVICESK9-M), Version 12.2(25)SED1, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Tue 22-Nov-05 23:37 by yenanh

Any idea ?

Yes, I do have an idea of what that might be. I believe it is the SNMP version you are using. I am pretty sure that is an SNMPv2 MIB, not v1. Here is a "get" to (kinda) prove my point:

Version (1):
/usr/bin/snmpget -r 3 -t 2000 -Oqv -v 1 -c <snmpread> 10.57.0.15:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: SNMPv2-SMI::enterprises.9.9.96.1.1.1.1.14.111

Version(2):
/usr/bin/snmpget -r 3 -t 2000 -Oqv -v 2c -c <snmpread> 10.57.0.15:161 1.3.6.1.4.1.9.9.96.1.1.1.1.14.111
No Such Instance currently exists at this OID

Change the SNMP version for that device to Version 2, or higher, and the problem should go away.

Cheers,

-chadd.
matexoman
Posts: 5
Joined: Mon Mar 23, 2009 11:07 am

Re: ConfigStore Plugin

Post by matexoman »

Thanks, works fine witch snmp v2.

Other question:

Has anyone used this plugin with HP equipment?
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

matexoman wrote:Thanks, works fine witch snmp v2.

Other question:

Has anyone used this plugin with HP equipment?

Not sure, but I added a bit of modularity a couple of revisions back, so that folks could right their own backup scripts and plug them into the framework. Here is a little "tutorial" I wrote in this thread a while back, on how to do your own backup script:

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.


I hope this helps. If your not able to write a script to do the backup portion, you'll have to give me some info about your HP devices (the way you want to back them up, oids, telnet dialog, etc.) and I can add it to the list of things I am working on right now ;) (long list...). If you are able to write the script and get it working, please send me the code, so I can add it to the next release. Thanks,

-chadd.
alexfossa
Posts: 7
Joined: Tue Mar 29, 2005 12:50 pm

Re: ConfigStore Plugin

Post by alexfossa »

Hi,

Bit of an odd one.

Cisco ASA 5505, tried with 5510 and 5540 with same results..

SSH and then TFTP for the config copy.

Getting.

spawn /usr/bin/ssh xifos@xx.yy.zz.50
xifos@xx.yy.zz.50's password:
RETURN CODE: 2


Tried ssh'ing from that box and it works...

Any ideas?

Thanks,

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

Re: ConfigStore Plugin

Post by chadd »

alexfossa wrote:Hi,

Bit of an odd one.

Cisco ASA 5505, tried with 5510 and 5540 with same results..

SSH and then TFTP for the config copy.

Getting.

spawn /usr/bin/ssh xifos@xx.yy.zz.50
xifos@xx.yy.zz.50's password:
RETURN CODE: 2


Tried ssh'ing from that box and it works...

Any ideas?

Thanks,

Alex

Sorry, I have been away. I will take a look at the code and refresh myself in the morning. I had this problem too, and I can't remember off the top of my head what the problem was. I am fairly sure it was not a bug though. I thought it had something to do with the config on the ASA. The error: RETURN CODE: 2 just means 'eof' (End Of File). If you want to try and debug the problem yourself, just poke around in configstore/lib/cisco_asa-ssh.exp. That is the expect script that is doing the backing up.
alexfossa
Posts: 7
Joined: Tue Mar 29, 2005 12:50 pm

Re: ConfigStore Plugin

Post by alexfossa »

Hi Chadd,

I've had a play about... but struggling.

If I go through the expect code... bit by bit... all looks fine... and in another window i've replayed the commands and it works..

Odd... any ideas?

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

Re: ConfigStore Plugin

Post by chadd »

alexfossa wrote:Hi Chadd,

I've had a play about... but struggling.

If I go through the expect code... bit by bit... all looks fine... and in another window i've replayed the commands and it works..

Odd... any ideas?

Alex

Try editing the cisco-asa.php file and just before:
exec($cmd, $result, $return_code);
In the cisco_asa_term_get_config function.

add: $log->lwrite('$cmd');

Then tail -f log/configstore.log

and see what it is issuing for the expect command. copy that command and paste it to a command line and see what happens. You might get more info that way. Let me know if you figure it out, if it is a bug, or whatever.

Also, have you tried to ssh into your firewall, and just copy run tftp to your tftp server to see if it works?

Have you gotten it to work on any other firewalls, equipment, etc.?

Hope this helps.

-chadd.
alexfossa
Posts: 7
Joined: Tue Mar 29, 2005 12:50 pm

Re: ConfigStore Plugin

Post by alexfossa »

Hi Chadd,

Nope, not got it to work on any of our firewalls.

Got it working really well on IOS devices, both routers and switches.

Yes, I can ssh to the fw from the cacti box, and copy off the startup config no probs.

I've tried adding that debug line... and I now get

'Can't open !'

When I try a backup.

Thanks,

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

Re: ConfigStore Plugin

Post by chadd »

alexfossa wrote:Hi Chadd,

Nope, not got it to work on any of our firewalls.

Got it working really well on IOS devices, both routers and switches.

Yes, I can ssh to the fw from the cacti box, and copy off the startup config no probs.

I've tried adding that debug line... and I now get

'Can't open !'

When I try a backup.

Thanks,

Alex

Make sure that the user you are running the script with (likely the web server user) has r/w permissions to the log directory within configstore. If so, try creating the configstore.log file, just to see if that is the problem.

Weird. I think that if you could see the actual "expect" command, you would see the problem, or at least be able to further troubleshoot. Also, look at the top of include/logger.class.php and make sure the first couple of lines look like this:

global $config;

// define log file
$log_file = $config['base_path'] . '/plugins/configstore/log/configstore.log';

if not, then you don't have the latest version, and that is why it can't find the file. If you don't have the above, and don't want to grap the latest code, just change $log_file to your full path to the log file - and make sure that your web user has permission to r/w to it. Good luck, let me know what you find out.

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

Re: ConfigStore Plugin

Post by chadd »

alexfossa wrote:Hi Chadd,

Nope, not got it to work on any of our firewalls.

Got it working really well on IOS devices, both routers and switches.

Yes, I can ssh to the fw from the cacti box, and copy off the startup config no probs.

I've tried adding that debug line... and I now get

'Can't open !'

When I try a backup.

Thanks,

Alex

Also:

1.) Could you post a screen capture of the login process to your ASA (removing anything you don't want us to see)?

2.) What version of ASA and code revision are you running? (I have two new ASA 5520s on my desk, I can test next week).

Sorry your having problems. If you don't figure it out by next week, I will at least be able to let you know if my new ASAs were able to be backed up.

-chadd.
sharekhan
Cacti User
Posts: 57
Joined: Mon Apr 04, 2011 10:47 am

Re: ConfigStore Plugin

Post by sharekhan »

Hi sir,

Thank u for Configstore

sir i am facing problem after creating account below are the error

Notice: Undefined index: hostname in /var/www/html/plugins/configstore/configstore_accounts.php on line 713

pls help to resolve it .
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

sharekhan wrote:Hi sir,

Thank u for Configstore

sir i am facing problem after creating account below are the error

Notice: Undefined index: hostname in /var/www/html/plugins/configstore/configstore_accounts.php on line 713

pls help to resolve it .

When is this happening? Did it let you create the account? Where are you seeing this error? Please provide some more info. This line in the code is just creating the checkbox at the end of the row, in the account display.. Not sure why you would get that error.

Did you check and make sure all the database tables got created? Anyway, if you like, you can PM me and we can work through it. Cheers.

-chadd.
sharekhan
Cacti User
Posts: 57
Joined: Mon Apr 04, 2011 10:47 am

Re: ConfigStore Plugin

Post by sharekhan »

Hi Sir,

I getting some error will attaching the file . Sorry, the board attachment quota has been reached.

I explain you step by step

I click the Console -> Configstore Device Accounts

Click --> ADD -> Account: [new]

1) Name = test (DONE)
2) Backup Protocol = TFTP (DONE)
3) Account Type = SSH (DONE)
4) Username = test
5) Password = test (The same user name pass created in router for testing purpose.)
6) Enable Password = (DONE)
7) Private Key Path = (What to add i don't know )
After fill the requirement i select to save but got the error message

Notice: Undefined index: hostname in /var/www/html/plugins/configstore/configstore_accounts.php on line 713

what its means , your help required , As per said i need to change some line but from were and how sir ,after that i select the device option

Configstore Devices

Click --> ADD -> Query: [new]

1) Enable Device = (I check the BOX)
2) Description = test
3) IP Address = 192.168.1.1 (Router ip add)
4) Directory = plugins/configstore/backups
5) Schedule = Daily
6) Device Type = Cisco-IOS
7) Authenication Account = test (Which i create in account option upwarde)

After finish i have start to taking backup but no success . but some how getting a error

Debug for test (192.168.1.1)
/usr/bin/snmpset -r 3 -t 500 -Oqv -v 3 -u Secure#log1 -a MD5 -A <snmpAuthpass> -x [None] -X -l authPriv 192.168.95.1:1 1.3.6.1.4.1.9.9.96.1.1.1.1.2.111 i 1 FAILED
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

So, even though it gives you an error, it still saves the account you created? I thought you were trying to create an SSH account.. Why is the debug showing SNMPv3? This is very weird..

what version of Cacti, and PIA, and ConfigStore do you have? I am going to do a fresh install on a VM and see if I can't reproduce the problems your having.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests