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

Linux and Config Maker

Post by Viggy »

Well its working... But not quite right....

I noticed that in the config file it was stating the tftp path

/usr/local/tftp/data/20060414

and creating the 20060414 folder. I noticed the apache user was creating the folder so I assumed this was a rights issue.

I switched my tftp server user from tftpd to apache thinking if apache was creating directories this would give the tftp server rights to them.

It didn't work

I then tried chmod -R on the 20060414 directory

This didn't work

So then I got drastic. I opened up the configmanager_gatewaytoprogram.php file and remmed out the following lines:

Code: Select all

/*        $val=$path."/".date('Ymd');
	  if ($config["cacti_server_os"] == "win32") $val=str_replace("/","\\",$val);
	  $tftppath= ($val=="")? "#TftpPath=\n": "TftpPath=$val\n";
          fwrite($handle,$tftppath);
*/
Now it doesn't create the tftppath line in the config files or the "date" directory in your tftp path.

But it works and the files end up in your default tftp directory.

Not as nice as intended, but functional. I would be curious to know what I have messsed up so I can remove this work around if any one knows.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

hello


In pancho documentation "TftpPath" function only when tftproot is given and "TftpPath" deeper than or the same as "tftproot".

Have you set it ?
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 think I have....

Here is the config file:

Listing of the config /usr/local/tftp/data/configmanagerid12.conf
[global]
TftpServer=192.168.11.158
TftpRoot=/usr/local/tftp
TftpPath=/usr/local/tftp/data/20060415
LogFile=/usr/local/tftp/data/configmanagerid12.conf.log
ForkLimit=10
StylePattern=::HOST::.::DATE::.cfg
StyleDate=%Y%m%d
SnmpVersion=2c
SnmpRetries=2
SnmpWait=5.2
SnmpMtu=1500
SnmpDebug=1
SnmpCommunity=sniffle
[192.168.11.2_3]
IpAddress=192.168.11.2
[192.168.11.5_5]
IpAddress=192.168.11.5


Here is the log:

Listing of the config /usr/local/tftp/data/configmanagerid12.conf.log
Apr 15 12:10:10 [EDT/-0400] pancho: (ERROR) 192.168.11.2_3 Source Configuration doesnt exist.
Apr 15 12:10:11 [EDT/-0400] pancho: (ERROR) 192.168.11.5_5 File Not Found


The folder gets created but the files don't
What else could I be doing wrong?
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: Linux and Config Maker

Post by pepj »

Viggy wrote: Listing of the config /usr/local/tftp/data/configmanagerid12.conf.log
Apr 15 12:10:10 [EDT/-0400] pancho: (ERROR) 192.168.11.2_3 Source Configuration doesnt exist.
Apr 15 12:10:11 [EDT/-0400] pancho: (ERROR) 192.168.11.5_5 File Not Found
This log shows pancho encountered a problem with these devices ....

Are you sure that pancho can download the router/switch configuration when you startet it manually from the shell ? with /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"

Are these devices supported by pancho ?
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

ConfigManager and Linux

Post by Viggy »

Everything works fine if I comment out that one one section in the configmanager_gatewaytoprogram.php file.

Well sort of.. the config files end up in the tftp root directory as opposed to the <tftp root>/data/<date> directory.

If I Manually edit the config file and lauch pancho from the command line it works but again files end up in the tftp root.

This may not be such a big issue for me because I would like to integrate this with Subversion and ViewVC.

Traditionally I organize my configs by location, What I am thinking of doing is checking out the directory (location) in Subversion using a pre command sent to Pancho. Then after the download, commit the change to subversion as a panch post command.

Then create a ViewVC Plugin page similar to the NTop page to see the directory of files.

Do you think that this will be too difficult of a modification? I would rather have version numbers through subversion than directories by date in the TFTP directory.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: ConfigManager and Linux

Post by pepj »

Viggy wrote:.. the config files end up in the tftp root directory as opposed to the <tftp root>/data/<date> directory.
As I said before. In pancho documentation "TftpPath" function only when tftproot is given and "TftpPath" deeper than or the same as "tftproot".
Viggy wrote: Traditionally I organize my configs by location,
In this new release you can give the format you want in
Pancho
Viggy wrote: What I am thinking of doing is checking out the directory (location) in Subversion using a pre command sent to Pancho. Then after the download, commit the change to subversion as a panch post command.
In this new release you can put for each configfile a pre and post command in pancho.
Viggy wrote: Then create a ViewVC Plugin page similar to the NTop page to see the directory of files.
This would be wonderful to have such a plugin.
Viggy wrote: Do you think that this will be too difficult of a modification? I would rather have version numbers through subversion than directories by date in the TFTP directory.
In this new release you can put "pre" and "post" command and give you own uploaded/downloaded file format for each configfile. When you want to pass the parameter from subversion to Pancho, this will be more dificult, but you can play with pre and post to solve it. But perhaps you don't need that with the new release because you can pass some parameters in the pre/post commands.

I hope I have solve all you problems
(don't forget you could mix the "TFTP" method and the "multi(SCP,SSH,...)" method. For example start the "subversion" with the "multi" method 5 minutes laters for the same hosts.
This second method is very powerful. I was surprised to use it for SSH, firewall, proxy, ...

PS: I cannot check a lot until the end of the next week because I am abroad. But this version should function well, because I only change the GUI and the Pancho file creation. Next week I will put it a official release.

PS: first do a "php ...plugins\configmanager\database_upgrade.php".

PS: In this release you can reset the "lastrun" direct from the first view in order to restart the config download/upload in 5 minutes.
Attachments
configmanager2c.jpg
configmanager2c.jpg (56.5 KiB) Viewed 13146 times
Last edited by pepj on Fri May 26, 2006 3:32 am, 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
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

pepj wrote:If someone has an idea how to solve this problem ..... (i.e: schedule later an another move)
Couldn't you do this the other way around? That is, move yesterdays config to the right place for archiving, just before requesting the new one.

We used to use Pancho, but gave up in the end, because they didn't really support much of our equipment (Nortel stuff). Now I use a series of custom scripts and something to automatically commit the files to Subversion to track changes more efficiently. You need to remove some comment lines from some config dumps, to stop changes being logged for the datestamp, but other than that, it's very handy! svn can run as a userland process in any folder too - no need for all that DAV stuff when it's all a local process.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

Couldn't you do this the other way around? That is, move yesterdays config to the right place for archiving, just before requesting the new one.
I think I have solved the problem. See FAQ 8 and FAQ 9.
We used to use Pancho, but gave up in the end, because they didn't really support much of our equipment (Nortel stuff). Now I use a series of custom scripts .... no need for all that DAV stuff when it's all a local process
I am lucky I never have a problem with pancho.
But I understand you ...
Therefore I created a second method "multi" in the configmanager plugin, where you can put your scripts. It is like a gateway between cacti and the own scripts. Here "no need for all that DAV stuff when it's all a local process"


(version 04bb removed because new version)
Now I have had some new template like
-telnet-cisco-unix --> download a config only with pure telnet (no cisco.pm or perl scripts). It was very tricky but functions very well. You can adapt it for your hardware
-telnet-and-SVN-cisco-unix the same but send it to subversion SVN
- ....

(I have only test these scripts on a linux but not coupled with cacti)
Try it and let me now if it is OK with cacti unix. I need feedback.
Last edited by pepj on Fri May 26, 2006 3:33 am, 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
wfeng
Posts: 6
Joined: Wed Jan 04, 2006 3:32 am

i no can to http://www.pancho.org

Post by wfeng »

who can i help me to http://www.pancho.org down pancho.
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Re: i no can to http://www.pancho.org

Post by JJX »

wfeng wrote:who can i help me to http://www.pancho.org down pancho.
??
pacho downlaod page is here:
http://www.pancho.org/download.html
cacti rulez!
wfeng
Posts: 6
Joined: Wed Jan 04, 2006 3:32 am

Post by wfeng »

troublesome you software upload to bbs,thanks.

my can not to open website.
jherrinike
Posts: 24
Joined: Wed May 10, 2006 2:46 pm
Location: Memphis, TN USA

Linux Issue

Post by jherrinike »

This looks like a really great plugin and a lot of effort was put into it. Great job. I am just having some problems getting started.

I have tried installing this plugin version .4bb on one of my Cacti test boxes. It is running:

cacti-0.8.6h
mysql 5.0
apache 2.2
php 5.1.2
net-snmp 5.1.4
rrdtool 1.2.12
Plugin Architecture 0.9
Many plugins

Going along with the manual.txt file included and getting through the Installation section I can get the compare configs screen to come up minus the compare image used for the button.

When I click on the manage configs link I get a popup with "error no right" and a blank screen. It is sounding like a permission error but the files do not have any different rights than any of my other plugin files. I have not installed pancho since I think the new versions do not require it.

If anyone has any ideas please let me know.

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

Re: Linux Issue

Post by pepj »

jherrinike wrote:"error no right"
For configmanager
You have to create a file secure.cfg (example secure.cfg.example) and insert the workstations which have a rigth to access to this plugin, same idea as on the firewalls.
I did it because it could be very dangerous if someone upload configuration on your switches or routers.

For the diff function you can force than it could be only possible under a subroutine. For this you have to rename 'securecompare.cfg.example' to 'securecompare.cfg' and change the parameter rootallowed
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
jherrinike
Posts: 24
Joined: Wed May 10, 2006 2:46 pm
Location: Memphis, TN USA

Post by jherrinike »

That worked. Thanks for the help. Can not wait to test it.

Thanks
slander
Posts: 32
Joined: Thu Mar 16, 2006 12:01 pm

Post by slander »

Pepj,

When you click the "show final configuration file", your script doesn't seem to correctly build the path to configmanagershow.php. For instance, my cacti plugin url is 'http://serverip/Cacti/plugins/configmanager/..." but, your script leaves out the "Cacti" portion. (IE "http://serverip/plugins"

I fixed this, for me, by changing line 336 of configmanager_edit.php from '."/plugins/configmanager...."' to '."/Cacti/plugins...."'. Not a very good fix, but works for my beta testing!

S

Reposted - Posted in the top layer by mistake!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests