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

new 0.5d correction of version 0.5a, 0.5b, 0.5c

Post by pepj »

new version 0.5d in first post

correction of the SQL auto_increment for versions 0.5a, 0.5b, 0.5c

The configmanager SQL-tables is automatically corrected after 5 minutes.
(if you want to do this quickly you can start "database_upgrade.php"
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 »

Hi Pepj,

thanks for your support. I updated to 0.5d but could still not create configs.

After I try to create a config I get the following message in the status line of the explorer:

[quote]
Seite http://xxxx/cacti/plugins/configmanager ... r=notsaved wird ge
kos
Posts: 25
Joined: Wed Nov 01, 2006 2:29 am
Location: Singapore

Post by kos »

uups, half of the message got lost.

I checked the sql tables and they look fine to me. But I attached them to doublecheck.

any idea?

thanks

kos
Attachments
configmanager02.doc
(93 KiB) Downloaded 227 times
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

kos wrote: SQL tables
1/ can you check, if you have the same tables plugin_cfgmng_basis, plugin_cfgmng, plugin_cfgmng_data as I have ? (see tables.zip)

2/ to check if the table is ok could you set manually (with your parameters)

Code: Select all

INSERT INTO plugin_cfgmng (
name,state,PCmanager,up_download,path,fileupload
,date,monthly,mon,tue,wed,thu,fri,sat,sun,lastused
,snmp_version,snmp_username,snmp_password,snmp_community,pathdata,configtype,command,templatename,post,pre,fileformat
,commit,startup,reload,tftp,usepancho,accepttrap,finishlog
) VALUES(
'thetestconfig','down','127.0.0.1','download','tftppath',''
,'0000-00-00 00:00:00',0,0,0,0,0,0,0,0,'0000-00-00 00:00:00'
,1,'','','yourcommunity','pathtodata','tftp','','','','','::HOST::.::DATE::.cfg'
,0,0,0,'1.1.1.1',1,0,0);
SQL answer ? do you see this configuration in configmanager ?
Attachments
tables.zip
(987 Bytes) Downloaded 213 times
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 »

Hi Pepj,
can you check, if you have the same tables plugin_cfgmng_basis, plugin_cfgmng, plugin_cfgmng_data as I have ? (see tables.zip)
I checked the tables and they look slightly different. I marked the differences in read.

It's a different order of the fields "configtype" and "pathdata". As well the pathdata null field is "no" instead of "yes".

And last but not least the the "finishlog" has as default "1" instead of "0"

I attached the doc with the table printout.

Thanks again for your support

kai
kos
Posts: 25
Joined: Wed Nov 01, 2006 2:29 am
Location: Singapore

Post by kos »

here is the attachment
Attachments
configmanager3.doc
(28.5 KiB) Downloaded 325 times
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

kos wrote:It's a different order of the fields
don't worry about the order
kos wrote:"finishlog" has as default "1" instead of "0"
It is the default for people who were migrating from 0.4 to 0.5 !?
Anycase it is not a problem ...

1/ what about the manually insert ? (step 2/ of the post before)

Code: Select all

select * from plugin_cfgmng;
This should be very interesting ...

2/ do you have in config.php following ?

Code: Select all

$cfgmngtable_basis = "plugin_cfgmng_basis";
$cfgmngtable = "plugin_cfgmng";
$cfgmngtable_data= "plugin_cfgmng_data";
3/ if you have no data, the best way should be to remove all files (except secure.cfg, securecompare.cfg,gzip.exe and diff.exe), drop the databases and install it (copy 0.5d files) again.
how to drop the databases

Code: Select all

drop tables oldconfigmanager;
drop tables oldconfigmanager_dat;
drop tables plugin_cfgmng;
drop tables plugin_cfgmng_basis;
drop tables plugin_cfgmng_data;
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
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

warnesj wrote: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.
I've also got it working on windows system. But configs I receive from "Nortel 55xx series devices are in binary format. As far as I could search through the mibs its impossible to upload config from device in ascii format. This makes useless "compare configs" feature in the plugin.

Am I missed anything or it's really so?

Thanks in advance.
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

Post by warnesj »

airwalk wrote:I've also got it working on windows system. But configs I receive from "Nortel 55xx series devices are in binary format. As far as I could search through the mibs its impossible to upload config from device in ascii format. This makes useless "compare configs" feature in the plugin.

Am I missed anything or it's really so?

Thanks in advance.
Nope you're not missing anything. I noticed this too and I was going to take a look at the code to see if I could get the ascii config out instead of the binary. I'm away for the next couple of weeks though so I'll try and get to that when I return.
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

warnesj wrote:Nope you're not missing anything. I noticed this too and I was going to take a look at the code to see if I could get the ascii config out instead of the binary. I'm away for the next couple of weeks though so I'll try and get to that when I return.
I'm afraid it's a limitation of Nortel stuff. As far as I could search S5-AGENT-MIB there's only one appropriate OID - s5AgSysAsciiConfigManualDownload.
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

pepj, I can successfully download config using pancho from command line. But when I setup download via your plugin nothing happens.
I can see from the log that execution has started but if I run network sniffer on poller machine I don't even see snmpset requests. What could be wrong and how the actual process could be traced. I've already set both gui and snmp depug on. Here below the output of the log.

thanks in advance.
Attachments
cfg.log.png
cfg.log.png (16.4 KiB) Viewed 5661 times
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

airwalk wrote: nothing happens...I don't even see snmpset requests.
the plugin started the function exec_background of cacti
exec_background($command_string, $parameters);

1/ can you execute (with the same user as cacti poller) the command in the log

Code: Select all

perl -I c:\ .....
2/ could you try changing the "configmanager Pancho Settings", putting the whole path for perl .....

3/ other possiblity is to start mannually (do a reset time before 'Choose an action:' in manage configurations' view)

Code: Select all

php configmanager_poller.php -d
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 »

airwalk wrote:
warnesj wrote: to take a look at the code to see if I could get the ascii config out instead of the binary.
I'm afraid it's a limitation of Nortel stuff.
I think the answer of your problem is "to download the running-config not the config" for pancho it means not use the "start" option !!!
Pancho set SNMP s5AgInfoFileAction to the value upldConfig(4) (to tftp) and downloadconfig=2 (from tftp)
Perhaps you have to set also for some hardware s5AgSysBinaryConfigFilename 1.3.6.1.4.1.45.1.6.4.4.4 to zero length string (It not very good explain in the MIB), but if not null the upload/download file will be binary !!!!.
see : http://www.felixtelecom.ro/Alte%20fisie ... S_2000.pdf
I am writting a pure PHP TFTP transfert. I could give you my code to test it, because I can no more test on nortel hardware.

Anyway If you cannot solve it with TFTP try with the method "multi". I've put some script for downloading Cisco with telnet and SCP(ssh). Take a look at these scripts to adapt it to Nortel. I created "multi" method because I think it is a good way managing configs without snmp and TFTP (less protocols to secure) and increasing the security. At this time "multi" do not reconize the hardware type, but it could be possible to do it, I think.
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 »

Hi Pepj,

I tried all your proposed steps but it still fails. :(
1/ what about the manually insert ? (step 2/ of the post before)
I inserted it manually and its working, I could see the data via config manager.
2/ do you have in config.php following ?
Code:
$cfgmngtable_basis = "plugin_cfgmng_basis";
$cfgmngtable = "plugin_cfgmng";
$cfgmngtable_data= "plugin_cfgmng_data";
Yes I have that files
3/ if you have no data, the best way should be to remove all files (except secure.cfg, securecompare.cfg,gzip.exe and diff.exe), drop the databases and install it (copy 0.5d files) again.
I did it, but it's still not working. I always get the failure message "configmanager.php?action=add&id=-1&error=notsaved" in the status line.

I am getting crazy, what could be the reason? Is there any restriction in the combination of plugins, windows.......?

regards

kai
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
  • 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.5d) NAM Viewer (nam - v0.1) Simple library page (library - v0.3) ipsubnet - v0.4b Dataquery (dataquery - v0.1.2a)
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

kos wrote: I inserted it manually and its working, I could see the data via config manager.
in this case the database should be OK ....
but it's still not working. "configmanager.php?action=add&id=-1&error=notsaved"
Is there any restriction in the combination of plugins, windows.......?
I don't think.
In our case there is something with the saving of the SQL parameters.

1/ try removing the " in line 253

Code: Select all

$id2 = sql_save2($save, "$cfgmngtable");
2/ do you have in one of the parameters( or password) a backslash or a " or ' or some special characters?
3/ insert line 254 of configmanager.php the following code. Each time you will do a save of the config your parameters and the SQL code will be inserted in the logfile of configmanager (either select Console/config updown-load/logfile or look at the file ...plugins/configmanager/cfgmng_logfile.txt)

Code: Select all

$message=date("d/m/Y H:i:s ")."SQL Save configuration's parameters in tables ".$cfgmngtable_data.". -> id result=$id2, code=".mysql_errno()
." errortext=".mysql_error()."\ndata to save are :".print_r($save,true)."\n";
cfgmng_log($message);
Could you look at the logfile ?
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