plugin for download/upload routers switches configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

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

Post by pepj »

eracouze wrote: /bin/pancho --download --config /usr/local/etc/pancho.conf
ERROR (cisco-7513): Network timeout
and
Pure PHP method:
DEBUG CiscoTFTPIOStransfert result: result=
DEBUG: HOST:203.146.15.246 RESULT:n
Both said the same (but I will change the error code for Pure PHP method
--> Network timeout
I do not know why. I have checked your hardware is supported for this mib and the snmp command have been sent.
Did you use the write community ?
Can see your device the TFTP server ?
eracouze wrote: Shell script method:
Command is "sh telnetdownloadunix.sh 172.16.20.1 user pass test.cfg 10". Result is "sleep: invalid time interval `10\r'". :o
please download the version 0.81. In this scripts there was DOS carriage return (I have now done a dos2unix)
After that it should function again.
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
Stunty
Posts: 21
Joined: Sun Jun 08, 2008 11:32 am
Location: France

Post by Stunty »

I'm also trying to backup my switch configuration but it is not working.
I filled in the TFTP filed into the cacti configuration and put my IP address and then configured the TFTP server to backup my config.
When I try to backup one config nothing happen. How can I check what part is going wrong (nothing is coming out,checked with wireshark)?
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s -c /var/routerconfigs
per_source = 11
cps = 100 2
flags = IPv4
}
This is my TFTP service file.
I am runing under CactiEZ 0.6, Centos 4.7, Cacti 0.8.7c

Here is what I get when I debug :
������������ ����'

[2J[0;0H[K[1;0H[K[2;0H[K[3;0H[K[4;0H[K[5;0H[K[6;0H[K[7;0H[K[8;0H[K[9;0H[K[10;0H[K[11;0H[K[12;0H[K[13;0H[K[14;0H[K[15;0H[K[16;0H[K[17;0H[K[18;0H[K[19;0H[K[20;0H[K[21;0H[K[22;0H[K[23;0HArrowKey/TAB/BACK=Move SPACE=Toggle ENTER=Select ESC=Back[0;0H[K[1;0H[K[2;0H[K[3;0H[K[4;0H[K[5;0H[K[6;0H[K[7;0H[K[8;0H[K[9;0H[K[10;0H[K[11;0H[K[12;0H[K[13;0H[K[14;0H[K[15;0H[K[16;0H[K[17;0H[K[18;0H[K[19;0H[K[20;0H[K[3;27H [3;27HLogin Screen[4;27H [4;27H============[7;24H [7;24HUser Name:[9;24H [9;24HPassword:[21;0H[K[21;0HAction->[21;18HEdit[21;25HExecute[21;18H[7mEdit[0m[21;18H��[0;0H[K[1;0H[K[2;0H[K[3;0H[K[4;0H[K[5;0H[K[6;0H[K[7;0H[K[8;0H[K[9;0H[K[10;0H[K[11;0H[K[12;0H[K[13;0H[K[14;0H[K[15;0H[K[16;0H[K[17;0H[K[18;0H[K[19;0H[K[20;0H[K[21;0H[K[22;0H[K[3;27H [3;27HLogin Screen[4;27H [4;27H============[7;24H [7;24HUser Name:[9;24H [9;24HPassword:[21;0HAction->[21;18HEdit[21;25HExecute[23;0HArrowKey/TAB/BACK=Move SPACE=Toggle ENTER=Select ESC=Back[21;18H[7mEdit[0m[21;18H[0mEdit[7m[7;36H [7;36H [7;36H[7;36Hexit[0m[0;0H[K[1;0H[K[2;0H[K[3;0H[K[4;0H[K[5;0H[K[6;0H[K[7;0H[K[8;0H[K[9;0H[K[10;0H[K[11;0H[K[12;0H[K[13;0H[K[14;0H[K[15;0H[K[16;0H[K[17;0H[K[18;0H[K[19;0H[K[20;0H[K[21;0H[K[22;0H[K[3;27H [3;27HLogin Screen[4;27H [4;27H============[7;24H [7;24HUser Name:[9;24H [9;24HPassword:[21;0HAction->[21;18HEdit[21;25HExecute[23;0HArrowKey/TAB/BACK=Move SPACE=Toggle ENTER=Select ESC=Back[0m[7;36H [7;36Hexit[7m[7m[9;36H [9;36H [9;36H[9;36H
I'm trying to backup a linksys switch.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

Stunty wrote:I'm also trying to backup my switch configuration but it is not working.
I'm trying to backup a linksys switch.
I need more information.

Which method are you using to do this "script", "tftp" with or without pancho ?
I think pancho will not function because linksys is not supported. for tftp pure PHP I should obtain the mib-tftp for linksys in order to adapt it. I didn't found the mibs for tftp on the net.

The only way to solve this easily sould be the script method. I could help you if you tell me what you are doing when you do it manually (ex. with telnet or ssh or ...).
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
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

Hi pepj,,,I have my config manager plugin working pretty good...I can run all my jobs manually anytime and a folder is created and cfg's are moved accordingly....BUT, scheduling them is a problem. I have for ex. one job scheduled to run On tuesdays...I set this up yesterday. The job runs at the first polling cycle in cacti @ 00:05 first thing tuesday/today. Here are the logs.


2009-06-02 00:05:49 pancho: (ERROR) idf1a-1 Post process 'mv /tftpboot/idf1a-1.20090601.cfg /tftpboot/switchconfigs/20090601' failed for idf1a-1.

2009-06-02 00:05:49 pancho: (SUCCESS) copied idf1a-1:running-config to 172.30.23.32:idf1a-1.20090602.cfg by cactiuser on SG-NETSTAT

2009-06-02 00:05:49 COPY LOGFILE /tftpboot/switchconfigs/Edge-1id21.conf.

2009-06-02 00:00:49 DEBUG: exec_background(/usr/bin/perl /usr/local/bin/pancho.pl --download --pre --post --config /tftpboot/switchconfigs/Edge-1id21.conf).

2009-06-02 00:00:49 create pancho config for Edge-1(configid=21) --> /tftpboot/switchconfigs/Edge-1id21.conf!2009-06-02 00:00:49 INFO: execute the upload/download configuration 21 (/tftpboot/switchconfigs/Edge-1id21.conf) with Pancho.

**** Notice the cfgs have the correct date for today but the POST cmd has yesterdays date, its like the Pre command didn't correctly mkdir for today's date?? Any ideas?
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

No matter what config I run...its like the date is not being refreshed in the configs or for the plugin...Is there a way to have that automated?? The refresh date option in the manage configs section does the trick but when one is schedule for future runs it seems to keep last date in the config?
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

For all who have this same issue...I just set up a cron to do the same thing....I wanted a Directory created with todays date ex. 20090605
then the configs created/pulled for today moved into that folder....done daily for all my switches/fireawalls etc.

Heres my bash script to do that..

#!/bin/bash
today=$(date +%Y%m%d)
if [ -d /tftpboot/switchconfigs/$today ]
then
echo "Directory Exists"
else
mkdir /tftpboot/switchconfigs/$today
chown cactiuser.cacti /tftpboot/switchconfigs/$today
echo "Directory Created"
fi

cd /tftpboot
mv *"$today".cfg /tftpboot/switchconfigs/$today

Should give you an idea anyhow..change your paths and permissions.

Peace
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Problems

Post by xefil »

<snip>

**solved ** :)
xefil
Cacti User
Posts: 233
Joined: Tue Jun 20, 2006 2:48 am
Location: Italy
Contact:

Post by xefil »

Not solved sorry...

I execute manually the follow with panchi installed:

[root@cacti configmanager]# perl -I/opt/cacti/plugins/configmanager/pancho/lib /opt/cacti/plugins/configmanager/pancho/pancho --download --config /tftpdata/configmanagerid1.conf

ERROR (MYHOST): Network timeout

Trying a RO community it gives me an error:
error: [2304] Net::SNMP::__ANON__(): Received noSuchName(2) error-status at error-index 1

Ok, it's readonly, also right.

Trying an unexisting comunity:

error: [2304] Net::SNMP::__ANON__(): No response from remote host '172.18.51.101'

But with existing comunity and RW the error:

ERROR (MYHOST): Network timeout

What's wrong?


In addition:

enabling TFTP-SERVER (xinetd), don't know it's requred :( I obtain:

[root@cacti configmanager]# perl -I/opt/cacti/plugins/configmanager/pancho/lib /opt/cacti/plugins/configmanager/pancho/pancho --download --config /tftpdata/configmanagerid1.conf

ERROR (HOST): Source Configuration doesnt exist.
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

Fixed it myself :oops:

was missing some dependencies and forgot to make the .exp file executable.

Only the compare I can't seem to get working side by side, but that's prolly just me.
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hi,

is it in your planning table to include the syslog-trigger through the CAMM-plugin?
I have to move from the sysloh/haloe plugin to the camm plugin due to the very hugh speedup in message-handling.

Torsten
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

patched for reducing device list

Post by torstentfk »

Hi,

I changed a little bit the list of devices to insert (displayed in the lower part of the cfg-edit window) :
Out-of-the-box there are all devices listed which are not included in the ACTUAL cfg-template. After the change only the devices are listed which are never part of any cfg-template. So the list give you an overview of devices that are not backuped.
Second I changed the list to display description of the host in the host column. This column is used for the device-name in the config scripts on the cli. Normally the IP address is used and all config-files on the disk are named according this name; hostnames are better for the admins :-)
(BTW: I removed the host check from the mac-track-tables..)

Code: Select all

/var/www/cacti/plugins/configmanager# diff cfg_mgr_org/configmanager_edit.php configmanager_edit.php 
217,223c217
<           if ($pref == "chkM_") {
<               // mactrac data
<               $temp = db_fetch_assoc("SELECT hostname FROM mac_track_devices WHERE device_id=$id");
<               $id=-$id;
<           } else {
<               $temp = db_fetch_assoc("SELECT hostname, snmp_community,snmp_version,snmp_username,snmp_password FROM host WHERE id=$id");
<           }
---
>               $temp = db_fetch_assoc("SELECT hostname, description, snmp_community,snmp_version,snmp_username,snmp_password FROM host WHERE id=$id");
232c226
<               $hostname= $temp[0]['hostname'];
---
>               $hostname= $temp[0]['description'];
237c231
<               $save["hostip"] = GetHostByName($hostname);
---
>               $save["hostip"] = $temp[0]['hostname'];
318c312
<       $withmactracold= (isset($_SESSION["sess_device_from_mactrac"])) ? $_SESSION["sess_device_from_mactrac"] : "0";
---
>       $withmactracold=  "0";
329,332c323,324
<       if ($filter!="") $sql_where = " where (host.hostname like '%%" . $filter. "%%')";
< //no more description             . "%%' OR host.description like '%%" . $filter . "%%')";
<       if ($filter!="") $sql_where_mactrac = " where (mac_track_devices.hostname like '%%" . $filter . "%%')";
< //no more description             . "%%' OR mac_track_devices.description like '%%" . $filter . "%%')";
---
>       if ($filter!="") $sql_where = " where (host.description like '%%" . $filter. "%%')";
> //                . " OR host.description like '%%" . $filter . "%%')";
378,385d369
<       // if mac_trac exist ...
<       $sql_request="SELECT device_id, hostname, device_type_id,disabled,devicename FROM mac_track_devices "
<                       ." ORDER BY device_id";
<       $mactrac = db_fetch_assoc($sql_request);
<       $existmactrac= 0;
<       if (sizeof($mactrac) > 0) {
<               $existmactrac= 1;
<       } else {
388d371
<       }
512c495
<                       ." where ((host.hostname='".$acthost."'));";  //(host.id='".$hostid."') and 
---
>                       ." where ((host.description='".$acthost."'));";  //(host.id='".$hostid."') and 
585a569,572
>         $sqlrequesttable = "select * from $cfgmngtable_data ";
>         $template_list = db_fetch_assoc($sqlrequesttable);
> 
> 
622a610
>                 //if ($acthost==$template["description"]) { $rep=1; break;}  
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

script for cisco-cfg incl. history

Post by torstentfk »

Hi,

added/changed the "telnetunixcisco" script:
- changed to run parallel scripts with non-conflicting temp-variables (original each script uses the same temp and overrides a parallel running script)
- added a history/diff function
- config only saved/archived if there is a config change
- filtered some cisco spec. outputs
- adapted to run also on content switches (term length adjusted, login-waits inserted)

the command to be entered is:
%g%/scripts/telnetunixhistory.sh %n% %u% %w% %p% %n%.cfg 40
in the path for saving the cfg (%p%) there have to be directories ./diff ./history

Attachment: updated filter and Catos implementation

Torsten
Attachments
telnetunixhistory.sh
fetches config from Cisco switches (IOS/CATos) and content switches with history functions
(1.55 KiB) Downloaded 3119 times
joseme
Cacti User
Posts: 90
Joined: Fri May 15, 2009 9:36 am

Trouble with snmp community length

Post by joseme »

Hi.
I realized the plugin only allows to write a snmp community with 15 characters (manage config- authentication).. I need to use it with 20 characters (for security)...... would it be possible to correct this?....


thanks
joseme
Cacti User
Posts: 90
Joined: Fri May 15, 2009 9:36 am

HI

Post by joseme »

I've fixed this issue, but now I have a trouble with the presentation in "compare" menu, seems it has not format...This only happens for "compare" th rest is OK.
Also, when I select "filename to compare" , the file does not appear in the second box (comparison's box).
Please, someone can check this.
I attach a capture.
Attachments
campare.JPG
campare.JPG (92.86 KiB) Viewed 19095 times
0.o
Posts: 9
Joined: Mon Nov 26, 2007 10:09 am

Post by 0.o »

This is an awesome addon to Cacti. There is only one thing that I can think that would make it better: SNMP backups. Cisco devices have the ability to use snmp-writes to send a config backup to a specified server using TFTP (and FTP too, I believe).
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests