plugin for download/upload routers switches configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
Dwayne_Dibbley
Cacti User
Posts: 52
Joined: Sun Sep 18, 2005 3:38 pm

Post by Dwayne_Dibbley »

In the log i see:

Error: Cannot download: 172.16.3.4 not activ.

What does not activ mean and how can i activ the device?

Im running PHP TFTP on win platform, I have checked the pure TFTP box and entered the IP of out TFTP server.

Thanks

Yours Confused as Ever

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

Post by pepj »

Dwayne_Dibbley wrote:Error: Cannot download: 172.16.3.4 not activ.
What does not activ mean and how can i activ the device?
either not reacheable or wrong community or ACL problem (or wrong snmp version). For downloading this must be the write community.

PS: which type of devices ?
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
Dwayne_Dibbley
Cacti User
Posts: 52
Joined: Sun Sep 18, 2005 3:38 pm

Post by Dwayne_Dibbley »

I change from V2 to V1 and sort of worked, these were Cisco 7200 routers. Problem is now out end as no RW community string, no SSH, i i dont think there is a command line plink equivilent for telnet with login / enable access etc?

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

Post by pepj »

Dwayne_Dibbley wrote:I change from V2 to V1 and sort of worked, these were Cisco 7200 routers. Problem is now out end as no RW community string, no SSH, i i dont think there is a command line plink equivilent for telnet with login / enable access etc?
It is possible ... :P The problem is that telnet protocol in windows do not read the input in not interactive mode. There are several solutions, but the easiest without programmation (C,WSscript) is with cygwin.
Here the solution.

1/ install cygwin if not already done
2/ Copy the command file "telnetdownloadcygwin.bat" under your_cactipath/plugin/configmanager/script
3/ copy template.txt under your_cactipath/plugin/configmanager/
4/ select this template in the configuration of the method "multi" of configmanager
5/ check if the last parameter (10) for the sleep is enough (see PostScriptum below)

I will insert it in the next realease.

PS: you can also directly use "telnetdownloadcygwin.bat" like this :
telnetdownloadcygwin.bat host user password your_path\nameofconfig.txt 10
PS the last parameter (sleep) could be very important when you have a low bandwith or the device is very busy.
Attachments
template.zip
(1.54 KiB) Downloaded 355 times
telnetdownloadcygwin.zip
(273 Bytes) Downloaded 316 times
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
_mario
Posts: 3
Joined: Mon Sep 17, 2007 12:32 am

Post by _mario »

Hi

If I run configmanager_poller.php by hand (CLI php) the config files download fine and "last run" on "manage configs" is set to current time, but when it runs naturally - "last run" not changed from "0000-00-00 00:00:00 " never. If I reset the last run date and run it manually again by running configmanager_poller then it works fine.... I use freebsd 6.2, cacti-0.8.6j.3_2, configmanager0.73, method pancho, other plugins (such as weathermap) works fine. What can be a problem ?
Last edited by _mario on Mon Sep 17, 2007 6:48 am, edited 2 times in total.
Dwayne_Dibbley
Cacti User
Posts: 52
Joined: Sun Sep 18, 2005 3:38 pm

Post by Dwayne_Dibbley »

It is possible ... The problem is that telnet protocol in windows do not read the input in not interactive mode. There are several solutions, but the easiest without programmation (C,WSscript) is with cygwin.
Thanks, but when we log in to a router we dont supply a username, then once logged in we have to type en and another password the be able to then "sh run". :(

Nigel
fernandakp
Posts: 27
Joined: Thu Jun 21, 2007 9:30 am

how can i check if the view for version 2 allow...?

Post by fernandakp »

how can i check if the view for version 2 allow...?
pepj wrote:
timi wrote: pancho: (ERROR) 192.168.5.5 Source Configuration doesnt exist.
1/
Are you sure that pancho can download the router/switch configuration when you startet it manually from the shell ?
with

Code: Select all

/usr/bin/perl -I/usr/src/redhat/SOURCES/Pancho-9.3.7/bin /usr/local/bin/pancho.pl --download --post --config /usr/local/tftp/data/configmanagerid12.conf.conf
You can try aso without "--post"

2/ could you try with snmp version 1

3/ check if the view for version 2 allow you to download the config
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

_mario wrote: If I run configmanager_poller.php by hand (CLI php) the config files download fine ... when it runs naturally - "last run" not changed from "0000-00-00 00:00:00 " never.
The is started automatically from the function configmanager_poller_bottom() in the setup.php. It is like manage-plugin.

1/ can you set "Poller Logging Level" to MEDIUM and do you see the "configmanager_poller.php" starts
2/ can you check if the cacti user have the execute rights on the files of configmanager ?
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 »

Dwayne_Dibbley wrote:
It is possible ... The problem is that telnet protocol in windows do not read the input in not interactive mode. There are several solutions, but the easiest without programmation (C,WSscript) is with cygwin.
... when we log in to a router we dont supply a username, then once logged in we have to type en and another password the be able to then "sh run". :(
Not a problem: have a look in the script of "telnetdownloadcygwin.bat" ... you can modify the commands

Code: Select all

(echo %2; echo %3; echo term len 0; echo sh run; sleep %5)
. These "echo" are exactly what the user do manually. The %1, %2, ... are the value of the 1st, 2nd, ... parameters gived in the confignamager. For example if you give first only a password and later a user and password
1/ give for example as command in the configmanager config:

Code: Select all

%g%/configmanager/scripts/telnetdownloadcygwin2.bat %n% %u% %w% %p%/%y%%m%%d%/%n%.cfg 10 firstpassword
2/ and in the "telnetdownloadcygwin2.bat" change

Code: Select all

(echo %6; echo %2; echo %3; echo term len 0; echo sh run; sleep %5)
PS: the step 1/ could be done directly in the template.txt
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
_mario
Posts: 3
Joined: Mon Sep 17, 2007 12:32 am

Post by _mario »

pepj wrote: 1/ can you set "Poller Logging Level" to MEDIUM and do you see the "configmanager_poller.php" starts
2/ can you check if the cacti user have the execute rights on the files of configmanager ?
Thanks for this hint. With "Poller Logging Level" - MEDIUM in logs I see
"09/24/2007 11:20:44 AM - SYSTEM CFG MANAGER POLLER:EXEC=/usr/bin/php -q /usr/local/share/cacti/plugins/configmanager/configmanager_poller.php /"
but /usr/bin/php is wrong path, earlier I have forgotten to change this value in "Cacti Settings (Paths)". I am surprised, how other plugins works with this wrong path ? %) (in crontab php path is valid)

PS after change php path to /usr/local/bin/php all works fine, thanks again.
fernandakp
Posts: 27
Joined: Thu Jun 21, 2007 9:30 am

Re: how can i check if the view for version 2 allow...?

Post by fernandakp »

I tested with the snmpset command and i have this answer:

snmpset -v 1 -c private 10.71.8.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.120 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.120 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.120 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.120 ipaddress "10.61.5.145" .1.3.6.1.4.1.9
.9.96.1.1.1.1.6.120 octetstring "configuration.confg" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.120 integer 4
.1.3.6.1.4.1.9.9.96.1.1.1.1.5.120: Bad value name (10.61.5.145)
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.120: Unknown Object Identifier (Sub-id not found: (top) -> configuration)



What it meas?


fernandakp wrote:how can i check if the view for version 2 allow...?
pepj wrote:
timi wrote: pancho: (ERROR) 192.168.5.5 Source Configuration doesnt exist.
1/
Are you sure that pancho can download the router/switch configuration when you startet it manually from the shell ?
with

Code: Select all

/usr/bin/perl -I/usr/src/redhat/SOURCES/Pancho-9.3.7/bin /usr/local/bin/pancho.pl --download --post --config /usr/local/tftp/data/configmanagerid12.conf.conf
You can try aso without "--post"

2/ could you try with snmp version 1

3/ check if the view for version 2 allow you to download the config
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: how can i check if the view for version 2 allow...?

Post by pepj »

fernandakp wrote: snmpset -v 1 -c private 10.71.8.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.120 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.120 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.120 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.120 ipaddress "10.61.5.145" .1.3.6.1.4.1.9
.9.96.1.1.1.1.6.120 octetstring "configuration.confg" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.120 integer 4
.1.3.6.1.4.1.9.9.96.1.1.1.1.5.120: Bad value name (10.61.5.145)
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.120: Unknown Object Identifier (Sub-id not found: (top) -> configuration)
The way you put the argument is not good.
For ipaddress try without "
But I think you should insert like this
snmpset -v 1 -c private 10.71.8.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.120 i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.120 i 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.120 i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.120 a 10.61.5.145 .1.3.6.1.4.1.9
.9.96.1.1.1.1.6.120 s "configuration.confg" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.120 i 4


For the error

Code: Select all

PHP Fatal error: Call to undefined function snmp_set_quick_print() in
I think you are not using PHP 5.x. PHP4.x needs several external libraries because several snmp functions are missing.

With PHP4 active Net-SNMP like this

Code: Select all

php example8_tftp_snmp_networkclass.php -i=your_IP_or_host -v=1 -c=your_community -m=2 --tftpdirection=download 
 --filesource=run --filedestination=your_file --tftpserver=your_tftp_server -d=1 -l=1 --path=your_path_to_net_snmp 
In your case

Code: Select all

php example8_tftp_snmp_networkclass.php  -d  -m=2 -v=1 -c=private -i=10.71.8.1 --tftpserver=10.61.5.145 --tftpdirection=download --filesource=run --filedestination=configfile.txt --path=your_path_to_net_snmp
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
achea
Posts: 6
Joined: Mon Sep 24, 2007 10:01 pm

Post by achea »

recently Im testing the trap event of "config up/down-load"
but have some trouble

test from the command line with "php configmanager_poller.php
success
test from the command line with "php configmanager_trap_poller.php
failed nothing happen

i have enabled the 'accept event'
syslog can recieve
'%LINK-5-CHANGED: Interface Loopback0, changed state to administratively down '
and i add
"cisco;;1.3.6.1.2.1.11.0.2"
in "configmanager_trap_list.txt"
1.3.6.1.2.1.11.0.2" means LinkDown in cisco oid
http://tools.cisco.com/Support/SNMP/do/ ... 2.1.11.0.2
but Im not quite sure if i pick the right value
i also tried "cisco;;LinkDown"
didnt work
did I miss sumthing
could anyone give me some help
fernandakp
Posts: 27
Joined: Thu Jun 21, 2007 9:30 am

Re: how can i check if the view for version 2 allow...?

Post by fernandakp »

Hello pepj,
i do have the php5, but now i discover why it couldnt find the function snmp_set_quick_print(). It was because the snmp lib was commented in my snmp.ini file. Now i have uncommented it and i have the following answer to the command:


1)
php example8_tftp_snmp_networkclass.php -d=1 -l=1 -m=1 -v=1 -c=private -i=10.71.8.1 --tftpserver=10.61.5.145 --tftpdirection=download --filesource=run --filedestination=configfile3.txt --path=/usr/bin
initialisation:OK
show the sysDescr
Found data query XML file at "./MIBXML/MIBtoLoad.xml"
sysDescr-> result=Cisco IOS Software, 1841 Software (C1841-ADVSECURITYK9-M), Version 12.4(1a), RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2005 by Cisco Systems, Inc. Compiled Fri 27-May-05 12:32 by hqluong
parameter passed to the classArray
(
[startup] => 0
[source] => download
[tftpip] => 10.61.5.145
[filesrc] => run
[filedest] => configfile3.txt
[binary] => 0
)

DEBUG: HOST:10.71.8.1 RESULT:Error: function in developpement .......n

Looking closely in the programmes in directory sharednetworkclass i noticed that this error appears in the snmp_default.class.php. Why "default" and not "cisco"? I tried from the user interface too but it didnt work neither. There is something that i am missing? some missing configuration ?


2)For your second tip, when you told me to change the method to 2, it worked ok in the command line, but how i can set this config by cacti schedule in config manager? I tried but i dont find any settings about this type of method used by pure TFTP.



I configured my router with debug snmp and terminal monitor to look what exactly was going on. In situation 2) it showed the mibs CopyTable.1.x.x and the values ok. But in the situation 1) it didnt show the snmp conversation with the mib CopyTable.1.x.x and values, just the mib system (i think that it is because in first place the snmp_networkclass.php do a sysDescr query ).


pepj wrote:
fernandakp wrote: snmpset -v 1 -c private 10.71.8.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.120 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.120 integer 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.120 integer 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.120 ipaddress "10.61.5.145" .1.3.6.1.4.1.9
.9.96.1.1.1.1.6.120 octetstring "configuration.confg" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.120 integer 4
.1.3.6.1.4.1.9.9.96.1.1.1.1.5.120: Bad value name (10.61.5.145)
.1.3.6.1.4.1.9.9.96.1.1.1.1.6.120: Unknown Object Identifier (Sub-id not found: (top) -> configuration)
The way you put the argument is not good.
For ipaddress try without "
But I think you should insert like this
snmpset -v 1 -c private 10.71.8.1 .1.3.6.1.4.1.9.9.96.1.1.1.1.2.120 i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3.120 i 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4.120 i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5.120 a 10.61.5.145 .1.3.6.1.4.1.9
.9.96.1.1.1.1.6.120 s "configuration.confg" .1.3.6.1.4.1.9.9.96.1.1.1.1.14.120 i 4


For the error

Code: Select all

PHP Fatal error: Call to undefined function snmp_set_quick_print() in
I think you are not using PHP 5.x. PHP4.x needs several external libraries because several snmp functions are missing.

With PHP4 active Net-SNMP like this

Code: Select all

php example8_tftp_snmp_networkclass.php -i=your_IP_or_host -v=1 -c=your_community -m=2 --tftpdirection=download 
 --filesource=run --filedestination=your_file --tftpserver=your_tftp_server -d=1 -l=1 --path=your_path_to_net_snmp 
In your case

Code: Select all

php example8_tftp_snmp_networkclass.php  -d  -m=2 -v=1 -c=private -i=10.71.8.1 --tftpserver=10.61.5.145 --tftpdirection=download --filesource=run --filedestination=configfile.txt --path=your_path_to_net_snmp
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

achea wrote:but have some trouble
test from the command line with "php configmanager_poller.php
success
test from the command line with "php configmanager_trap_poller.php
use only "php configmanager_poller.php -d" this will check and start php configmanager_trap_poller.php if needed
achea wrote: have enabled the 'accept event'
syslog can recieve
'%LINK-5-CHANGED: Interface Loopback0, changed state to administratively down '
and i add
"cisco;;1.3.6.1.2.1.11.0.2"
in "configmanager_trap_list.txt"
1.3.6.1.2.1.11.0.2" means LinkDown in cisco oid
but Im not quite sure if i pick the right value
i also tried "cisco;;LinkDown"
The LinkDown or 1.3.6.1.2.1.11.0.2 should be ok in fact it shoud be something that appears in the traps (see the syslog).

1/ have you in the global setting "Up/Download Config Manager" set
accept traps ----> yes
delay to wait after a trap ----> some minutes
2/ in each config you want active:
accept events ----> yes
3/ the config is an "active rule" (not paused)
4/ check in the view "trap events"
You can see:
- the global trap events activation is enabled.
- the delay to wait after a trap is XXmin.
- there is X configurations with trap events enabled.
- you see the list of the confis of configmanager which accept traps
view of the file with the traps
5/ at the beginning active the debug of configmanager in the global setting "Up/Download Config Manager"
6/ is the traps "LinkDown" in syslog ?
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
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests