plugin for download/upload routers switches configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
Viggy
Posts: 23
Joined: Fri Sep 16, 2005 5:15 pm
Location: MI, USA

grammar

Post by Viggy »

Active / Paused might eliminate the confusion I had.

It also probably didn't help that I hadn't had enough sleep when I tried to install the plugin.

Again, a truly great job and thank you for sharing it with the group.

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

new version with compare (diff) function

Post by pepj »

Here the new version

(picture in the first three posts !!!!)

With the compare function (diff) that a lot of people were waiting .... I needed more times because I had to rewrite the "browser" function of PHP because I needed to see files on the server not on the client.

You can submit you idea or correction (I cannot test linux, but I try programming without).

Some explanations:
Comparaison tool: you can compare what you want its a diff. I tested only under window
at this time but it should also function under linux. For the Windows users
I have put a diff.exe in the configmanager plugins which has the same parameters
as under linux.

security:
2/ For the comparaison of the file I want to use the same idea in order
to avoid the access above the specified directory. I use the file
"securecompare.cfg"
Last edited by pepj on Sat Mar 25, 2006 8:26 pm, edited 1 time in total.
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

some views

Post by pepj »

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 »

For the people with PHP4 I 've changed the function scandir (only in PHP5)

change the file compare.php


The file included has been removed because the newer versions solved this issue and my post reached the max size
Last edited by pepj on Wed Dec 13, 2006 12:12 pm, edited 1 time in total.
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 »

Here the release with comparaison of zip of gz files.
I've corrected some errors for unix in the compare function

also ok for PHP4

PS: For the compare (diff function) check it you have the following temporary folder './plugins/configmanager/temp'

PS: the gzip and diff for windows are in the first post. put them in /plugins/configmanager/ or create a PATH
Last edited by pepj on Thu Apr 06, 2006 5:36 am, edited 4 times in total.
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
flavour
Posts: 15
Joined: Wed Sep 28, 2005 9:37 am

Post by flavour »

Warning: mkdir(/var/www/cacti-0.8.6h/plugins/configmanager/temp): Permission denied in /var/www/cacti-0.8.6h/plugins/configmanager/compare.php on line 50

If the webserver needs to have rights to create this folder (or to make use of a pre-existing folder, which is safer) then this needs documenting.
Really, I think a subfolder off the system's /tmp would be better...but this mightn't play as nicely in Win32...

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

Post by pepj »

you can create a temp folder in "/plugins/configmanager/"
The plugin try to create the result of the diff or of the unzipped file in a folder /plugins/configmanager/temp so if it isn't exist try to create it.

I wil exlain it in the manual.txt

PS: How does function this plugin in unix ? (I got feedback only for windows and programm it like a blind for unix because cannot check it)

PS: the gzip and diff for windows are in the first post.

thanks
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
petero
Posts: 13
Joined: Sun Jul 17, 2005 3:45 pm
Location: Poland

Little input / ideas

Post by petero »

Hi this plugin is great but as i read on pachno.org its supports only few vendors and ONLY polling via SNMP.

I was wondering if maybe cacti community could help you developing few upgrades for this like
-> getting config via telnet/ssh command line
example:

telnet 1.1.1.1 [l:admin p:xxxx]
and then commands to execute:
enable (like expect in bash password_2)
xxxx
copy running-config tftp://12.12.12.12/.....
quit/logout

This way we can each develop vendor-script like for D-Link,3com and so on copy config scripts with logging on to switches, routers and so on.

I this with small support we can easily provide help for such upgrade.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

Hi

Thanks for the idea.

I want to do something like this for scp/ssh, and if my idea is realisable you will be able to put inside templates for other possibilities like ftp. So all people will be happy I hope.

(The good thing with pancho is you don't have to know what a device it is and under window telnet cannot do so much as in unix. And for the upload you don't have to copy the whole configuration, but only the new changes).
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 with SCP SSH SFTP ....

Post by pepj »

Hello

I am proud to announce this new version with also the possibility to download/upload with SCP, SSH, SFTP, and more ...

I want to put more helps and pictures later ....

It would be good at telling me if it is good under unix (I think yes)

PS: In this version each person can create a template and so help the community. So if you have good templates tell us that

PS: for the users of the old version you must start: "php database_upgrade.php" and check the realms (user-management). I change it to 70.

PS: the gzip and diff for windows people are at the first post. or the last post of http://cactiusers.org/forums/viewtopic.php?p=1064#1064
Last edited by pepj on Tue Apr 04, 2006 5:39 pm, edited 2 times in total.
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
User avatar
ScOp3
Cacti User
Posts: 61
Joined: Wed Aug 03, 2005 4:14 am
Location: Cologne Germany
Contact:

Post by ScOp3 »

Thanks for the update and the Plugin. I am trying to get this working and have some problems with "--post" execution from the plugin via pancho.

my config looks like this:

tftp path: /srv/tftpboot
data default: /backup/configs <- where i want the cisco .cfg's to reside

Funny thing is the file gets tftp'ed to the tftpd root like it should but then the "post -> mv" fails to get the cfg file into the proper directory.

The log says ERROR -> mv /srv/tftpboot//<filename> /backup/configs/<date>/.
I am not sure but i think the problem is within the double "//" which are the result of the config written by you're plugin.

The code in the config looks like this -> "post= ::FULLPATH::/::FILENAME::". I thinkt he the "/" between fullpath and filename might be the issue. Unfortunatly i can't test it because everytime i remove the slash the plugin automagically replaces it.

Any hint on this issue?


ScOp3

PS: In deutsch wäre das evt. kürzer zu schreiben gewesen ^^
fear leads to anger, anger leads to hate and dancing leads to sex!
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

ScOp3 wrote: Funny thing is the file gets tftp'ed to the tftpd root like it should but then the "post -> mv" fails to get the cfg file into the proper directory.
The log says ERROR -> mv /srv/tftpboot//<filename> /backup/configs/<date>/.
I've solved the "error message" but I think we have to forget the idea with move ... in the plugin ... It is a big metaphysic problem ...
I began to do this with a extern move because my TFTP could not change the directory and other TFTP could copy the data only in a subfolder of the root TFTP.
But now we have a big synchronisation's problem, we cannot know when the TFTP has finished to download all the files. I have see now this problem: in some cases some files are not copied under the folder yyymmdd because the move started before the TFTP download was finished. You can see this problem we you have for example very few routers but some of these have a litte bandwidth. Sometimes only one was copied sometimes two or all. !!!!!
With A very hudge amount of routers/switches I had no problem .. until now.

I remove my idea of "move" but activate the TftpRoot and Tftppath parameters of Pancho for the people who have a TFTP which can do this.
So all the data will be copied under the TFTP path data.

If someone has an idea how to solve this problem ..... (i.e: schedule later an another move)

PS: If you want to try again with move you can "uncomment" the line 257 to 267 of the file "configmanager_gatewaytoprogram.php" (remove /* and */)

PS: Ich habe ken Problem auf Deutsch ou en français, but the Cacti community should understand us.
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 Release !!! at the first Post & pictures

Post by pepj »

NEW Release !!! at the first Post & pictures

Now I have activate the dynamic help which shows the help dedicated for the script or plugin I or you have put in the template.txt

Also the new pictures in a few seconds....



The configmanager0.3b included has been removed because of newer versions and my post reached the max size.
Last edited by pepj on Wed Dec 13, 2006 12:14 pm, edited 1 time in total.
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
User avatar
Viggy
Posts: 23
Joined: Fri Sep 16, 2005 5:15 pm
Location: MI, USA

Linux and Config Maker

Post by Viggy »

I have converted to LInux and am having trouble getting this running again.

It is not "creating" or the configuration files.

if a Manually create a config file and run it at the command line it works.

perl -I/usr/src/redhat/SOURCES/Pancho-9.3.7/bin /usr/local/bin/pancho.pl --download --post --config /usr/local/tftp/data/configmanagerid5.conf

If the poller attemptsto run this same command it fails.
User avatar
Viggy
Posts: 23
Joined: Fri Sep 16, 2005 5:15 pm
Location: MI, USA

Linux and plugin

Post by Viggy »

OK

I am getting closer.

It now creates the config file and the log file in the correct directory but fails on downloading files.

here is the output from the cacti log

04/14/2006 03:25:09 PM - SYSTEM CFG MANAGER:exec_background(/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/configmanagerid7.conf)

04/14/2006 03:25:09 PM - SYSTEM CFG MANAGER:createconfig for configmanager(configid=7) --> /usr/local/tftp/data/configmanagerid7.conf!



here is the output from the configmanager log


Apr 14 15:15:11 [EDT/-0400] pancho: (ERROR) 192.168.11.2_3 Source Configuration doesnt exist.
Apr 14 15:15:11 [EDT/-0400] pancho: (ERROR) 192.168.11.5_5 File Not Found
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests