plugin for download/upload routers switches configuration
Moderators: Developers, Moderators
Re: plugin for download/upload routers switches configuratio
When i use the telnetdownloadunix script on my linux cacti server, i got a small issue.
- For one device, it works. My first router is backupped normally.
- But when i've got several devices, it goes wrong. From the second one, the backup only shows 'building configuration'. And this is so for all following backups in that group. So only my first one is correct.
Any idea what's going on?
- For one device, it works. My first router is backupped normally.
- But when i've got several devices, it goes wrong. From the second one, the backup only shows 'building configuration'. And this is so for all following backups in that group. So only my first one is correct.
Any idea what's going on?
- Cacti: 0.8.8f / Plugin Architecture Version: 3.1 / Linuxbased
- Third Party: Apache 2.4.12 / PHP 5.6.11 / NET-SNMP version 5.3.2.2 / RRDTool 1.5.4
- Plugins: Configmanager 0.826 / Aggregate 0.70B2 / Manage 0.6.2 / Weathermap 0.97a / Thold 0.4.9 / Quicktree 0.2 / Realtime 0.5 / Settings 0.7
- Data:Host 1341 / Graphs 6752
Re: plugin for download/upload routers switches configuratio
1/ first try from shell to start for one 'unlucky' devicebrononi wrote:When i use the telnetdownloadunix script on my linux cacti server, i got a small issue.
- For one device, it works. My first router is backupped normally.
- But when i've got several devices, it goes wrong. From the second one, the backup only shows 'building configuration'. And this is so for all following backups in that group. So only my first one is correct.
Any idea what's going on?
./telnetdownloadunix host_or_ip user password file_to_create 4
and look at the created file
2/ perhaps temp file conflict. To correct it change all 'temp' into 'temp$1' in order to have different temp files per each device.
PS: in the new release I will offer new scripts' versions with more options and logfile and the integrations of new or own scripts will be very easy.
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
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
Re: plugin for download/upload routers switches configuratio
Great, is working perfectly with this.pepj wrote:2/ perhaps temp file conflict. To correct it change all 'temp' into 'temp$1' in order to have different temp files per each device.
For the moment, my script (telnetdownloadunix.sh) is like:
Code: Select all
#!/bin/sh
(echo "$2"; echo "$3"; echo "term len 0"; echo "show run"; echo "exit"; sleep $5
) | telnet $1 > temp$1
csplit -k -f temp temp$1 '/show run/'
rm -f temp$1
if test -f temp00 ; then rm -f temp00; fi
if test ! -f temp01 ; then exit; fi
echo mv temp01 $4
mv temp01 $4
Can't wait! We're battling with other backup programs (infovista, rma...), but seems like cacti is winning. So if i can prove now that cacti can handle every device we want...pepj wrote: PS: in the new release I will offer new scripts' versions with more options and logfile and the integrations of new or own scripts will be very easy.
- Cacti: 0.8.8f / Plugin Architecture Version: 3.1 / Linuxbased
- Third Party: Apache 2.4.12 / PHP 5.6.11 / NET-SNMP version 5.3.2.2 / RRDTool 1.5.4
- Plugins: Configmanager 0.826 / Aggregate 0.70B2 / Manage 0.6.2 / Weathermap 0.97a / Thold 0.4.9 / Quicktree 0.2 / Realtime 0.5 / Settings 0.7
- Data:Host 1341 / Graphs 6752
Re: plugin for download/upload routers switches configuratio
In addition to dos2unix, I had to modify the SQL statements to change "TYPE=MyISAM" to "ENGINE=MyISAM"
Just an FYI.
Just an FYI.
-
- Posts: 28
- Joined: Mon Feb 02, 2009 10:21 am
- Location: CHINA
Re: plugin for download/upload routers switches configuratio
Hi, I want to download the configuration file of MOTO CMTS. Follow the telnetdownloadunix.sh, I made my script telnetdownloadmotocmtsunix.sh:
#!/bin/sh
( echo "$2"; echo "en"; echo "$3"; echo "copy running-conf tftp://10.2.7.104/${1}.cfg"; sleep 13; echo "exit"; sleep 2) | telnet $1
The template is telnet-download-moto-cmts-unix.
In the data parameters:
Command: %g%/configmanager/scripts/telnetdownloadmotocmtsunix.sh %n% %w% %o%
precommand: [ ! -d /var/lib/tftpboot/moto-cmts%y%%m%%d% ] && mkdir /var/lib/tftpboot/moto-cmts%y%%m%%d%
post command: mv /var/lib/tftpboot/%n%.%y%%m%%d%.cfg /var/lib/tftpboot/moto-cmts%y%%m%%d%
My script purpose is to download the configuration file to the tftpserver. The password and enable password should be right. I executed telnetdownloadmotocmtsunix.sh manually. It works fine, the cmts configuration file can be downloaded to the tftpserver. However the script does not work in the plugin. I even can not read any login event from the cmts log.
The log:
2011-11-08 17:10:02 CFG MANAGER: DEBUG: post command 'mv /var/lib/tftpboot/10.160.255.3.20111108.cfg /var/lib/tftpboot/moto-cmts20111108' return ->OK
2011-11-08 17:10:02 CFG MANAGER: DEBUG: exec_background(/var/www/html/cacti/plugins/configmanager/configmanager/scripts/telnetdownloadmotocmtsunix.sh 10.160.255.3 *** ***) for following hosts:10.160.255.3
2011-11-08 17:10:01 CFG MANAGER: DEBUG: pre command ' [ ! -d /var/lib/tftpboot/moto-cmts20111108 ] && mkdir /var/lib/tftpboot/moto-cmts20111108' return ->OK
2011-11-08 17:10:01 CFG MANAGER: DEBUG: createconfig for Moto_CMTS_configmanager(configid=3)!
2011-11-08 17:10:01 CFG MANAGER: INFO: execute Script method configuration 3 (Moto_CMTS_configmanager).
08/11/2011 17:10:01 CFG MANAGER: INFO: Database synchronisation. result=OK for UPDATE plugin_cfgmng_data SET hostip='10.160.255.3' WHERE (configmanagerid=3) AND (hostname='10.160.255.3');
08/11/2011 17:10:01 CFG MANAGER: INFO: Database synchronisation. result=OK for UPDATE plugin_cfgmng_data,host SET plugin_cfgmng_data.hostname=host.hostname WHERE ((plugin_cfgmng_data.hostid>0) AND (plugin_cfgmng_data.configmanagerid=3) AND (plugin_cfgmng_data.hostid=host.id));
08/11/2011 17:10:01 CFG MANAGER: INFO: Database synchronisation. result=OK for UPDATE plugin_cfgmng_data,host SET plugin_cfgmng_data.description=host.description WHERE ((plugin_cfgmng_data.hostid>0) AND (plugin_cfgmng_data.configmanagerid=3) AND (plugin_cfgmng_data.hostid=host.id));
#!/bin/sh
( echo "$2"; echo "en"; echo "$3"; echo "copy running-conf tftp://10.2.7.104/${1}.cfg"; sleep 13; echo "exit"; sleep 2) | telnet $1
The template is telnet-download-moto-cmts-unix.
In the data parameters:
Command: %g%/configmanager/scripts/telnetdownloadmotocmtsunix.sh %n% %w% %o%
precommand: [ ! -d /var/lib/tftpboot/moto-cmts%y%%m%%d% ] && mkdir /var/lib/tftpboot/moto-cmts%y%%m%%d%
post command: mv /var/lib/tftpboot/%n%.%y%%m%%d%.cfg /var/lib/tftpboot/moto-cmts%y%%m%%d%
My script purpose is to download the configuration file to the tftpserver. The password and enable password should be right. I executed telnetdownloadmotocmtsunix.sh manually. It works fine, the cmts configuration file can be downloaded to the tftpserver. However the script does not work in the plugin. I even can not read any login event from the cmts log.
The log:
2011-11-08 17:10:02 CFG MANAGER: DEBUG: post command 'mv /var/lib/tftpboot/10.160.255.3.20111108.cfg /var/lib/tftpboot/moto-cmts20111108' return ->OK
2011-11-08 17:10:02 CFG MANAGER: DEBUG: exec_background(/var/www/html/cacti/plugins/configmanager/configmanager/scripts/telnetdownloadmotocmtsunix.sh 10.160.255.3 *** ***) for following hosts:10.160.255.3
2011-11-08 17:10:01 CFG MANAGER: DEBUG: pre command ' [ ! -d /var/lib/tftpboot/moto-cmts20111108 ] && mkdir /var/lib/tftpboot/moto-cmts20111108' return ->OK
2011-11-08 17:10:01 CFG MANAGER: DEBUG: createconfig for Moto_CMTS_configmanager(configid=3)!
2011-11-08 17:10:01 CFG MANAGER: INFO: execute Script method configuration 3 (Moto_CMTS_configmanager).
08/11/2011 17:10:01 CFG MANAGER: INFO: Database synchronisation. result=OK for UPDATE plugin_cfgmng_data SET hostip='10.160.255.3' WHERE (configmanagerid=3) AND (hostname='10.160.255.3');
08/11/2011 17:10:01 CFG MANAGER: INFO: Database synchronisation. result=OK for UPDATE plugin_cfgmng_data,host SET plugin_cfgmng_data.hostname=host.hostname WHERE ((plugin_cfgmng_data.hostid>0) AND (plugin_cfgmng_data.configmanagerid=3) AND (plugin_cfgmng_data.hostid=host.id));
08/11/2011 17:10:01 CFG MANAGER: INFO: Database synchronisation. result=OK for UPDATE plugin_cfgmng_data,host SET plugin_cfgmng_data.description=host.description WHERE ((plugin_cfgmng_data.hostid>0) AND (plugin_cfgmng_data.configmanagerid=3) AND (plugin_cfgmng_data.hostid=host.id));
Re: I can't download config file of switch!
pepj wrote:You need more parameters to test this script.ddonohue wrote:#/cacti-0.8.6h/plugins/configmanager/scripts/telnetdownloadunix.sh ip address /var/depot/target.cfg
missing operand
all parameters are important, the sleep is very important, one of my secrets for this script.
/cacti-0.8.6h/plugins/configmanager/scripts/telnetdownloadunix.sh ipaddress_or_hostname user password /var/depot/target.cfg timeforsleep
I tried it under linux.
PS: But in the template.txt I put "(windows)" and "(unix)" one time on the wrong place. It should be behind "help=" like this -->
name=sftp-firewall-putty-windows
command=pscp -l %u% -pw %w% -sftp %n%:TMP/* %p%/%y%%m%%d%/
help=(windows) Here an example for secure FTP SFTP with pscp of putty.
name=telnet-cisco-unix
command=%g%/configmanager/scripts/telnetdownloadunix.sh %n% %u% %w% /var/depot/%n%.cfg 4
help=(unix) download with Telnet of the running-config of a Cisco router. The last parameter is for sending a sleep in order to wait for the logging. The parameters are: the router, user, password and destinationsfile.
Here attached is the right template.txt file
Hi pepj,
- I'm following guide u. Try it command
Code: Select all
[root@Log-10 scripts]# sh telnetdownload-auto-unix.sh 10.0.0.46 admin 12345 10.0.0.46.conf 4
Connection closed by foreign host.
988
124
mv temp01 1.0.0.46.conf
Code: Select all
username admin autocommand show running-config
Code: Select all
2960-CAMERA-F8>show running-config
^
% Invalid input detected at '^' marker.
2960-CAMERA-F8>exit
Please help me!
-
- Posts: 6
- Joined: Wed Jan 04, 2012 2:59 pm
- Location: Rosario, Santa Fe, Argentina
Re: plugin for download/upload routers switches configuratio
Hi pepj !
I have the next problem.
I need to backup the config of variuos mikrotik hosts at weekly periods, with the plugin Configmanager
The log of activity in the file cfgmng_logfile.txt is:
2012-04-12 18:10:08 CFG MANAGER: INFO: execute Script method configuration 2 (backupMikrotik).
2012-04-12 18:10:09 CFG MANAGER: DEBUG: exec_background(lftp -u admin,*** -e "get today.backup -o /var/backups/Mikrotik/192.168.175.1-12-04-2012.backup; bye" 192.168.175.1) for following hosts:192.168.175.1
The command works perfect from the cacti box command line.
I run the lftp sentence and the .backup file is created succesfully.
But i dont know why don´t work from inside the plugin interface.
The script in the file template.txt is:
name=lftp-mikrotik-linux
command=lftp -u %u%,%w% -e "get today.backup -o /var/backups/Mikrotik/%n%-%d%-%m%-%y%.backup; bye" %i%
help=(linux) XXXX XXXX XXXX XXX
I have chmoded to 777 the directory /var/backups/Mikrotik/ too.
Any ideas ?
Thanks in advance !
I have the next problem.
I need to backup the config of variuos mikrotik hosts at weekly periods, with the plugin Configmanager
The log of activity in the file cfgmng_logfile.txt is:
2012-04-12 18:10:08 CFG MANAGER: INFO: execute Script method configuration 2 (backupMikrotik).
2012-04-12 18:10:09 CFG MANAGER: DEBUG: exec_background(lftp -u admin,*** -e "get today.backup -o /var/backups/Mikrotik/192.168.175.1-12-04-2012.backup; bye" 192.168.175.1) for following hosts:192.168.175.1
The command works perfect from the cacti box command line.
I run the lftp sentence and the .backup file is created succesfully.
But i dont know why don´t work from inside the plugin interface.
The script in the file template.txt is:
name=lftp-mikrotik-linux
command=lftp -u %u%,%w% -e "get today.backup -o /var/backups/Mikrotik/%n%-%d%-%m%-%y%.backup; bye" %i%
help=(linux) XXXX XXXX XXXX XXX
I have chmoded to 777 the directory /var/backups/Mikrotik/ too.
Any ideas ?
Thanks in advance !
__________________________
Roberto Longo
Rosario - Santa Fe - Argentina
Roberto Longo
Rosario - Santa Fe - Argentina
Re: plugin for download/upload routers switches configuratio
I'm using this plugin for testing upload speed of uplink from Cisco router to some server. The problem is that plugin timeout script after 20 seconds, even file upload has not finished jet.
If I start script manualy from shell, file upload ends succesfully.
Where is this 20 seconds value?
If I start script manualy from shell, file upload ends succesfully.
Where is this 20 seconds value?
Re: plugin for download/upload routers switches configuratio
All,
I have an issue with the compare funtion under linux.
All is fine when I use 2 plain text files, but
It doesn't work very well when you want to compare 2 .gz files.
the left pane is always empty, and the file that the pane refers to (f1_4.txt), does not exist anymore.
Can anyone help me.
jimmy
I have an issue with the compare funtion under linux.
All is fine when I use 2 plain text files, but
It doesn't work very well when you want to compare 2 .gz files.
the left pane is always empty, and the file that the pane refers to (f1_4.txt), does not exist anymore.
Can anyone help me.
jimmy
Re: plugin for download/upload routers switches configuratio
All,
After I removed (commented out) lines 371 throu 374 in the compare.php files, it seems to work better.
lines:
//jim if (is_file($tempdir."/f1"."_".$_SESSION["sess_user_id"].".txt"))
// unlink($tempdir."/f1"."_".$_SESSION["sess_user_id"].".txt");
// if (is_file($tempdir."/f2"."_".$_SESSION["sess_user_id"].".txt"))
// unlink($tempdir."/f2"."_".$_SESSION["sess_user_id"].".txt");
I'm not a php wizzard, so can anyone tell me if this will break things?
Jim
After I removed (commented out) lines 371 throu 374 in the compare.php files, it seems to work better.
lines:
//jim if (is_file($tempdir."/f1"."_".$_SESSION["sess_user_id"].".txt"))
// unlink($tempdir."/f1"."_".$_SESSION["sess_user_id"].".txt");
// if (is_file($tempdir."/f2"."_".$_SESSION["sess_user_id"].".txt"))
// unlink($tempdir."/f2"."_".$_SESSION["sess_user_id"].".txt");
I'm not a php wizzard, so can anyone tell me if this will break things?
Jim
- vesparossa
- Posts: 6
- Joined: Fri Apr 04, 2014 3:31 am
Re: plugin for download/upload routers switches configuratio
Hi guys,
since I got several problems to pass username and password to some devices I suggest to pass $2 and $3 arguments (username and password) using echo command with -e and force a carriage return with \r
Example:
echo -e "$2\r";
Final result is:
#!/bin/sh
(echo -e "$2\r"; echo -e "$3\r"; echo -e "term len 0\r"; echo -e "show run\r"; echo "exit"; sleep $5
) | telnet $1 > temp$1
echo temp$1
csplit -k -f temp temp$1 '/User login successful./'
rm -f temp$1
if test -f temp00 ; then rm -f temp00; fi
if test ! -f temp01 ; then exit; fi
echo mv temp01 $4
mv temp01 $4
Andre
since I got several problems to pass username and password to some devices I suggest to pass $2 and $3 arguments (username and password) using echo command with -e and force a carriage return with \r
Example:
echo -e "$2\r";
Final result is:
#!/bin/sh
(echo -e "$2\r"; echo -e "$3\r"; echo -e "term len 0\r"; echo -e "show run\r"; echo "exit"; sleep $5
) | telnet $1 > temp$1
echo temp$1
csplit -k -f temp temp$1 '/User login successful./'
rm -f temp$1
if test -f temp00 ; then rm -f temp00; fi
if test ! -f temp01 ; then exit; fi
echo mv temp01 $4
mv temp01 $4
Andre
Who is online
Users browsing this forum: No registered users and 4 guests