plugin for download/upload routers switches configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
shahbour
Posts: 16
Joined: Fri Nov 30, 2007 6:35 pm

Post by shahbour »

Hello,

Code: Select all

 snmpset -v 2c -c XXXXX 192.168.38.2 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.123 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.123 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.123 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.123 ipaddress "192.168.38.6" .1.3.6.1.4.1.9.9.96.1.1.1.1.6.123 octetstring "/tftpboot/myconfig.txt" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.123 integer 4
.1.3.6.1.4.1.9.9.96.1.1.1.1.5.123: Bad value name (192.168.38.6)
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.123: Unknown Object Identifier (Sub-id not found: iso -> /tftpboot/myconfig)
i tried it with "" and without adn also tftpboot/myconfig and /tftpboot/myconfig in both i got same result


.1.3.6.1.4.1.9.9.96.1.1.1.1.5.123: Bad value name (192.168.38.6)
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.123: Unknown Object Identifier (Sub-id not found: iso -> /tftpboot/myconfig)
shahbour
Posts: 16
Joined: Fri Nov 30, 2007 6:35 pm

Post by shahbour »

Do u think trying on different Cisco routers will be better.
MikeAlt
Posts: 2
Joined: Thu Oct 18, 2007 12:53 am

No output created via telnet

Post by MikeAlt »

Hi community,

I tried a lot of changes in my config but without success.
I would like to collect the config with telnet, but no files created.
The log show me everything is ok. I cannot see any errors.
2007-12-19 16:12:08 exec_background(/var/www/html/plugins/configmanager/configmanager/scripts/telnetdownloadmatrixdfe.sh 10.10.10.10 admin *** /data/10.10.10.10-2007-12-19.cfg) for following hosts:10.10.10.10
the command:
%g%/configmanager/scripts/telnetdownloadmatrixdfe.sh %n% %u% %w% %p%%n%-%y%-%m%-%d%.cfg
the script:
#!/bin/sh
(echo "$2"; echo "$3"; echo "set length 0"; echo "show config"; echo "exit"; sleep $5
) | telnet $1 > temp
csplit -k -f temp temp '/show run/'
rm -f temp
if test -f temp00 ; then rm -f temp00; fi
if test ! -f temp01 ; then exit; fi
echo mv temp01 $4
mv temp01 $4
System is UNIX.

Can you help me to get it running ?


regards and thx

Mike
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

please, delete this message
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

What message are you asking to be deleted?

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?
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

TheWitness wrote:What message are you asking to be deleted?

TheWitness
Forget. I was asking to delete the message saying "please, delete this message" because the original message was made by mistake.

The following somewhat doesn't relate to the plugin functionality but I feel it could be of use for some.
Just FYI. I found a bug in Cisco's implementation of scp. IOS is C2800NM-ADVIPSERVICESK9-M, Version 12.4(12), RELEASE SOFTWARE (fc1).

This deals at least with Cacti on win32.
If I try to run pscp with the path to write output to containg "/" then a router crashes and undergoes a cold restart. If the folder delimitered by slash doesn't exist then pscp won't be able to create one for you and will hang till timeout expires. Cisco reports to syslog the following messages and then reboots immediately(!!!!).

15: *Dec 21 18:29:35 MSK: %SYS-5-RESTART: System restarted --
16: Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(12), RELEASE SOFTWARE (fc1)
17: Technical Support: http://www.cisco.com/techsupport
18: Copyright (c) 1986-2006 by Cisco Systems, Inc.
19: Compiled Fri 17-Nov-06 12:02 by prod_rel_team
20: *Dec 21 18:29:35 MSK: %SNMP-5-COLDSTART: SNMP agent on host MSK-WAN-MKH-1 is undergoing a cold start
21: *Dec 21 18:29:36 MSK: %SSH-5-ENABLED: SSH 1.99 has been enabled
221: Dec 21 18:38:37 MSK: %SYS-2-WATCHDOG: Process aborted on watchdog timeout, process = SSH Process.
222: -Traceback= 0x42520988 0x42520AA0 0x4252B40C 0x4252B4BC 0x4252B9D0 0x4252C95C 0x4252D8AC 0x425342B0 0x42527260 0x42194A48 0x42194A2C

That was quite a flap when tried to run a script during business hours.
Please, be aware! =)
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

airwalk wrote: The following somewhat doesn't relate to the plugin functionality but I feel it could be of use for some.
Just FYI. I found a bug in Cisco's implementation of scp. IOS is C2800NM-ADVIPSERVICESK9-M, Version 12.4(12), RELEASE SOFTWARE (fc1).
... crash ....
Thanks for the advice (I will check it in two weeks. At this time I have not the same release on any C2800 and have no problem)

But I have NO problem with the IOS "Cisco IOS Software, 2800 Software (C2800NM-IPVOICEK9-M), Version 12.4(12), RELEASE SOFTWARE (fc1)
flash:c2800nm-ipvoicek9-mz.124-12.bin".

Do you have open a case by cisco ? (So they will also check this for the next release ...)
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: No output created via telnet

Post by pepj »

MikeAlt wrote:I tried a lot of changes in my config but without success.
I would like to collect the config with telnet, but no files created.
The log show me everything is ok. I cannot see any errors.
... configmanager/scripts/telnetdownloadmatrixdfe.sh %n% %u% %w% %p%%n%-%y%-%m%-%d%.cfg
Hello

1/ you don't pass the most important parameter (the last) the sleep-time. You don't know how quick you router answer in particularly on the WAN or when very busy ...
2/ echo "set length 0" is for CatOs. For IOS You need: echo "term length 0"
3/ you have: csplit -k -f temp temp '/show run/' but "echo "show config". It is never equal
4/ pay attention with your temp because you create and remove it. The problem could be your shell don't start where you want !!! I will prefer to give the whole path or to have a parameter.

Solution:
the command:

Code: Select all

%g%/configmanager/scripts/telnetdownloadmatrixdfe.sh %n% %u% %w% %p%%n%-%y%-%m%-%d%.cfg 10
the script:

Code: Select all

#!/bin/sh
(echo "$2"; echo "$3"; echo "term length 0"; echo "show running"; echo "exit"; sleep $5
) | telnet $1 > /var/temp
csplit -k -f /var/temp /var/temp '/show run/'
rm -f /var/temp
if test -f /var/temp00 ; then rm -f /var/temp00; fi
if test ! -f /var/temp01 ; then exit; fi
echo mv /var/temp01 $4
mv /var/temp01 $4
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

shahbour wrote:
- Normally pancho runs on almost all cisco device.

- I have test on the same router and IOS "Cisco C2600 ios 12.2(4)".
I have see NO problem with pancho (and manually) with version 1 and version 2c
I only become the same error when I use the read community !!!! With the write community NO problem.

I send you my manually function I have done
on windows

Code: Select all

snmpset -v 2c -c WRITEcommunity 172.30.0.1 1.3.6.1.4.1.9.9.96.1.1.1.1.2.111 i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.111 i 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.111 i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.111 a "172.30.0.2" .1.3.6.1.4.1.9.9.96.1.1.1.1.6.111 s "test/myconfig.txt" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 i 4
iso.3.6.1.4.1.9.9.96.1.1.1.1.2.111 = INTEGER: 1
iso.3.6.1.4.1.9.9.96.1.1.1.1.3.111 = INTEGER: 4
iso.3.6.1.4.1.9.9.96.1.1.1.1.4.111 = INTEGER: 1
iso.3.6.1.4.1.9.9.96.1.1.1.1.5.111 = IpAddress: 172.30.0.2
iso.3.6.1.4.1.9.9.96.1.1.1.1.6.111 = STRING: "test/myconfig.txt"
iso.3.6.1.4.1.9.9.96.1.1.1.1.14.111 = INTEGER: 4

On Unix solaris

Code: Select all

snmpset -v 2c -c WRITEcommunity 172.30.0.1 1.3.6.1.4.1.9.9.96.1.1.1.1.2.111 integer32 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.111 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.111 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.111 ipaddress "172.30.0.2" .1.3.6.1.4.1.9.9.96.1.1.1.1.6.111 octetstringascii "test/myconfigunix.txt" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.111 integer 4
PS: with TFTPpure PHP I have to check the version 2c something not correct I think
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
fata51
Posts: 17
Joined: Wed Nov 16, 2005 8:34 am

Post by fata51 »

Hi,

First of all , I'd like to thank you for all your great job. I'm trying the plugin for the fist time and after a little while, I'm configuring my first task in order to download the running config of one of my cisco switch. But it failed, I'm getting this logs :

2008-02-01 10:00:06 exec_background ( ***) for following hosts:192.168.169.247
2008-02-01 10:00:06 Error: download. RESULT: Unknown Copy Failure not activ.
DEBUG CiscoTFTPIOStransfert result: result=Unknown Copy FailureUnknown Copy Failure
DEBUG CiscoTFTPIOStransfert: random number=850, source=run, source's file=4, destination=tftp, thedestination's file=1
DEBUG tftp typtransfert=ciscoIOS
Found data query XML file at './plugins/sharednetworkclass/MIBXML/MIBtoLoad.xml'
2008-02-01 10:00:03 Load class "Cisco" of 192.168.169.247 for download
Found data query XML file at './plugins/sharednetworkclass/MIBXML/MIBtoLoad.xml'
Found data query XML file at './plugins/sharednetworkclass/MIBXML/RFC1213-MIB.xml'
Found data query XML file at './plugins/sharednetworkclass/MIBXML/MIBtoLoad.xml'
2008-02-01 10:00:03PHP tftp download of 192.168.169.247(192.168.169.247)
2008-02-01 10:00:03 createconfig for TEST(configid=1)!
2008-02-01 10:00:03 Path is:/usr/bin

Any tips?

Thanks.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

fata51 wrote: 2008-02-01 10:00:06 exec_background ( ***) for following hosts:192.168.169.247
2008-02-01 10:00:06 Error: download. RESULT: Unknown Copy Failure not activ.

....
2008-02-01 10:00:03 Load class "Cisco" of 192.168.169.247 for download
Found data query XML file
Hello

It begins not bad 10:00:03 and can read on the cisco device...

I think You are using a read community ..... instead write (needed for having rights on the cisco configuration)

PS: if you are using snmp v2 or v3 please install the new version in the first post.
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

new version of configmanager and sharednetworkclass

Post by pepj »

new version of configmanager and sharednetworkclass
see first post.

current version configmanager: 0.76
current version sharednetworkclass: 0.39

corrections from configmanager 0.75 to 0.76:
  • - bug snmp v2
    - add new options for snmp v3 (some like priv auth are not supported in pancho, only with snmp pure PHP).
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
fata51
Posts: 17
Joined: Wed Nov 16, 2005 8:34 am

Post by fata51 »

Hi,

Thanks for your reply. I just checked, I'm using a SNMPv1 RW community. It doesn't work. Here is my config file from the logs page :

[binair] => 0
[delay] => 0
[finishlog] => 0
[accepttrap] => 0
[usepancho] => 0
[tftp] => 192.168.169.72
[reload] => 0
[startup] => 0
[commit] => 0
[fileformat] => ::HOST::.::DATE::.cfg
[pre] =>
[post] =>
[templatename] =>
[command] =>
[snmp_community] => pilou
[snmp_password] =>
[snmp_username] =>
[snmp_version] => 1
[lastused] => 0000-00-00 00:00:00
[sun] => 0
[sat] => 0
[fri] => 0
[thu] => 0
[wed] => 0
[tue] => 0
[mon] => 0
[monthly] => 0
[date] => 2008-02-01 09:34:00
[fileupload] => /data/upload.cfg
[pathdata] => /data
[path] => /data
[up_download] => download
[PCmanager] =>
[state] => up
[configtype] => tftp
[name] => TEST
[id] => 1
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

fata51 wrote: [fileupload] => /data/upload.cfg
[pathdata] => /data
This parameter must be relative to tftp root (a tftp server cannot write outside)
so [pathdata] => empty in your case

you can also test directly with with snmpnetworkclass

Code: Select all

cd ...yourcactipath\plugins\sharednetworkclass
php example8_tftp_snmp_networkclass.php -i=IP-address-device -v=1 -c=YourCommunity --tftpdirection=download --filesource=run --filedestination=filenameandpathundertftproot.txt --tftpserver=YourTFTPserver -d
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
fata51
Posts: 17
Joined: Wed Nov 16, 2005 8:34 am

Post by fata51 »

pepj wrote:
fata51 wrote: [fileupload] => /data/upload.cfg
[pathdata] => /data
This parameter must be relative to tftp root (a tftp server cannot write outside)
so [pathdata] => empty in your case

you can also test directly with with snmpnetworkclass

Code: Select all

cd ...yourcactipath\plugins\sharednetworkclass
php example8_tftp_snmp_networkclass.php -i=IP-address-device -v=1 -c=YourCommunity --tftpdirection=download --filesource=run --filedestination=filenameandpathundertftproot.txt --tftpserver=YourTFTPserver -d
thanks, it's working now.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests