plugin for download/upload routers switches configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
lga
Posts: 21
Joined: Mon May 23, 2005 4:39 am
Location: Belgium

Post by lga »

Hi pepj,

I applied your patch and all works fine !! Big thks ! ;-)

I use your plugins to backup more than 400 devices and it works very fine.

Continue the improvement of this plugin ;-)

Regards,

Lionel.
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

i have a problem, in the log file i have this:

Dec 19 14:31:52 [EET/+0200] pancho: (ERROR) 192.168.5.5 Source Configuration doesnt exist.


the config file looks like this:
[global]
TftpServer=192.168.5.1
TftpRoot=/data
TftpPath=/data
LogFile=/data/testid2.conf.log
ForkLimit=10
StylePattern=::HOST::.::DATE::.cfg
StyleDate=%Y%m%d
SnmpVersion=2c
SnmpRetries=2
SnmpWait=5.2
SnmpMtu=1500
SnmpDebug=0
SnmpCommunity=writecom
[10.128.0.3]
IpAddress=192.168.5.5

what can i do ?
i'm running cacti .6h, and the device is "IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE (fc1)"
kos
Posts: 25
Joined: Wed Nov 01, 2006 2:29 am
Location: Singapore

can not create config files

Post by kos »

Hi Pepj,

I installed the plugin but I can't create config files. Under "manage configs" I select "add" and get the template to configure a file.

After clicking "create" the page gets refreshed, but no file is created. The sql tables "plugin_cfgmng_xxx" remain empty - in other words: nothing happened.

How can I solve the issue?


kos
Attachments
configmanager01.JPG
configmanager01.JPG (83.03 KiB) Viewed 8632 times
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

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
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

Re: can not create config files

Post by pepj »

kos wrote: nothing happened.
I saw the detected IP remote address is empty ...

Could you check the file secure.cfg ?
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
kos
Posts: 25
Joined: Wed Nov 01, 2006 2:29 am
Location: Singapore

Can not see config files

Post by kos »

Hi Pepj,

the remote IP address is visible, I just deleted it in the pic.
Cacti Version - 0.8.6i
Plugin Architecture - 1.0
Poller Type - Cactid v0.8.6f
Server Info - Windows NT 5.2
Web Server - Microsoft-IIS/6.0
PHP - 5.1.4
PHP Extensions - bcmath, calendar, com_dotnet, ctype, date, ftp, hash, iconv, odbc, pcre, Reflection, session, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, ISAPI, gd, mysql, snmp, sockets
MySQL - 5.0.24-community-nt
RRDTool - 1.2.15
SNMP - 5.3.0.1
Plugins
  • Read-only Devices Tab (devices - v0.4)
    PHP Network Weathermap (weathermap - v0.82)
    Update Checker (update - v0.3)
    Device Monitoring (monitor - v0.7)
    Host Info (hostinfo - v0.1)
    Simple Links page (links - v0.3)
    RRD Cleaner - v1.2
    Configuration manager (configmanager - v0.5b)
    NAM Viewer (nam - v0.1)
    Simple library page (library - v0.3)
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: Can not see config files

Post by pepj »

kos wrote:
Could you show me was you put in the config before to click on create button ?
Could you click first on a button for method tftp or scp ?

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
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

Post by warnesj »

Hey Pepj, great plugin! I just got it running on my Fedora Core 6 Cacti installation and it's downloading the configs for many of my switches and routers (mainly Nortel stuff).

Here were some of the things I had to do to get it running in my environment,
  • It took a bit of time to get the Pancho configuration right. My TFP server is different then my Cacti server. I have my TftpRoot set to / and the TftpPath of my TFTP config set to the subdirectory of my TFTP server where my configs are saved.
  • When creating a TFTP config I needed to have a fully-qualified path for the Pancho config file location. ie: /usr/share/cacti/plugins/configmanager/configs. And this path needs to be writable for the cacti user.
  • I needed to modify the Baystack.pm module for Pancho for my Nortel 5500 series of switches. Easy enough to do, find

    Code: Select all

    my %types = (
                  BayStack => "Nortel/Baystack family",
                 'Business Policy Switch 2000' => "Nortel/Baystack family"
                );
    and change it to

    Code: Select all

    my %types = (
                  BayStack => "Nortel/Baystack family",
                 'Business Policy Switch 2000' => "Nortel/Baystack family",
                 'Ethernet Routing Switch 55' => "Nortel/Baystack family"
                );
    .
  • The Nortel switches are limited to 30 characters. So if you're using IP addresses and Dates for the filename format of your downloaded files, the downloads may fail because the names are too long.
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

Post by warnesj »

Hey all, I made a little modification to the configmanager_poller.php script that I thought I'd share. I have about 96 devices and I'm using the TFTP (Pancho) method to backup their configs. I was curious as to why my cfgmng_logfile.txt log file only had some of the Pancho log (5 minutes worth of the file). I took a look at the code of the configmanager_poller.php script (I hope that's okay pepj) and it appears that the poller assumes that the backup should be done by the time the next polling period, which is 5 minutes. The problem I have is that not all my devices have finished backing up yet in the 5 minutes before the Pancho log file is copied to the cfgmng_logfile.txt file. :(

So I added a little bit to the configmanger_poller.php script it to look to see if all the devices that are in the config have reported a status to the Pancho log file. If not my addition doesn't allow the Pancho log file to be copied to until all devices have reported. Once all devices have reported a status the rest of pepj's code is ran which copies the Pancho log file to the cfgmng_logfile.txt file.

What I did was in the configmanager_poller.php find,

Code: Select all

//$message=date("d/m/Y H:i:s ")."COPY LOGFILE ???$finishlog??? $configname.\n";
//cfgmng_log($message);
                 if ($finishlog=="1") {
                   $confignamelog = $configname .".log";
and change it to,

Code: Select all

//$message=date("d/m/Y H:i:s ")."COPY LOGFILE ???$finishlog??? $configname.\n";
//cfgmng_log($message);
//Check to see if all the devices have reported back in the log file
              $logfilelinecount = count(file($configname . ".log"));
              $sqlrequest = "select * from plugin_cfgmng_data where configmanagerid='" . $configid . "' and state = 'enable'";
              $temp = db_fetch_assoc($sqlrequest);
              $devicecount = count($temp);
              if ($logfilelinecount!=$devicecount) {
                      $message=date("d/m/Y H:i:s ")."INFO: " . $configname . ".log has " . $logfilelinecount . " of " . $devicecount . " devices with a reported status.  Not copying logfile yet.\n";
                      cfgmng_log($message);
                      $finishlog="0";
              }
                 if ($finishlog=="1") {
                   $confignamelog = $configname .".log";
This should add a couple of new INFO messages to your configmanager logfile like these,
Image
Hope this is helpful.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

warnesj wrote: I took a look at the code of the configmanager_poller.php script (I hope that's okay pepj) and it appears that the poller assumes that the backup should be done by the time the next polling period, which is 5 minutes.
It's OK. I 've insert your changes in the new version 0.5c and also the correction for starting the UNIX script with ";" (some post before)
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
kos
Posts: 25
Joined: Wed Nov 01, 2006 2:29 am
Location: Singapore

Post by kos »

Could you show me was you put in the config before to click on create button ?
Could you click first on a button for method tftp or scp ?
Pepj:
I can click on the button for "multiple configuration type", no problem. The config I create please find in the attachment.

After I click create, the page is refreshed again, but no config is stored (the plugin_cfgmng_data table and plugin_cfgmng table stay empty). It seems to me that nothing happens after clicking "create" :(

thanks
kos
Attachments
configmanager01.doc
(129.5 KiB) Downloaded 284 times
didx
Posts: 31
Joined: Fri Jun 16, 2006 5:25 am
Location: Lille France

problem with 0.5c

Post by didx »

Hi Pepj!

I've tried to install v0.5c but i get into trouble...

When I click on manage config and then the "Add" button, I get the form but the problem is that none but the "Cancel" button work

If I click on "Cancel" ... well ... it does cancel
But when I click either on "tftp method" or on "create" button... it simply does nothing...

I tried to simulate by calling "http://[...]/configmanager?action=save"
I got this message:

=======================
Notice: Undefined index: chk_config_state in /home/www/cacti/plugins/configmanager/configmanager.php on line 175

Warning: Cannot modify header information - headers already sent by (output started at /home/www/cacti/plugins/configmanager/configmanager.php:175) in /home/www/cacti/plugins/configmanager/configmanager.php on line 256
========================

When I come back in "manage config"... the config is saved but when I click on it ... I see this message on the top of the page (just befor "show final configuration file...."):

====================================
function SelectAllSeveralCheckbox(formname,prefix, checkbox_state) { for (var i = 0; i < document.forms[formname].elements.length; i++) { if ((document.forms[formname].elements.name.substr(0, prefix.length) == prefix) && (document.forms[formname].elements.style.visibility != 'hidden')) { document.forms[formname].elements.checked = checkbox_state; } } } function ShowConfigmanager(configid) { }
====================================

Furthermore, When click on "logfile", the cacti menu that should be on the left takes half the page... and the logfile appears at the bottom of it... not on the right side...

could you help me understand what is happenning?

Thanks for all the work you've already done...
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: problem with 0.5c

Post by pepj »

didx wrote: I've tried to install v0.5c but i get into trouble...
I have seen it. It seems the sql_save function of cacti do not save the data (or always with the same id). I am searching why ...

which was the last version without this problem.
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 »

:)
I have found the problem: The auto_increment is no more activated. I don't know why in setup.php this option "auto_increment" is not really executed when the tables are not manually created. (I've got no errors)

At this time to correct it, open a SQL session and apply:

Code: Select all

ALTER TABLE plugin_cfgmng_data MODIFY column id INT NOT NULL AUTO_INCREMENT,ADD INDEX (id);
ALTER TABLE plugin_cfgmng MODIFY column id INT NOT NULL AUTO_INCREMENT,ADD INDEX (id);
I will try to do it automatically ...
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 »

kos wrote: problem with configurations' creation
Hi

It is the same problem as the post before:

Code: Select all

open a SQL session:
mysql.exe --user=root --password cacti
enter your password
then ....
ALTER TABLE plugin_cfgmng_data MODIFY column id INT NOT NULL AUTO_INCREMENT,ADD INDEX (id); 
ALTER TABLE plugin_cfgmng MODIFY column id INT NOT NULL AUTO_INCREMENT,ADD INDEX (id); 
I will correct it in the code.
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 0 guests