plugin for download/upload routers switches configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
ranug
Posts: 16
Joined: Tue Jul 03, 2007 12:55 pm
Location: Austria

Post by ranug »

This is the output (what I expected):
your cacti system is: unix

here some tests from template.txt (did not work but just to see the logfile output). I tried these scripts in this order: test, telnet-cisco-unix, scp-cisco-linux
2007-11-21 09:35:49 purge log.
2007-11-21 09:40:12 INFO: execute Multi method configuration 1 (configmanager).
2007-11-21 09:40:12 createconfig for configmanager(configid=1)!
2007-11-21 09:40:12 exec_background(echo user:username password:*** TEST:\test.txt testhost log:configmanagerid1.log short:\data\configmanagerid1.log path:\data date:2007-11-21 >\usr\share\webapps\cacti\0.8.6j-r6\htdocs\plugins\configmanager\TEST.txt) for following hosts:testhost

2007-11-21 09:42:23 INFO: execute Multi method configuration 1 (configmanager).
2007-11-21 09:42:24 createconfig for configmanager(configid=1)!
2007-11-21 09:42:24 exec_background(/usr/share/webapps/cacti/0.8.6j-r6/htdocs/plugins/configmanager/scripts/telnetdownloadunix.sh testhost username *** \var\depot\testhost.cfg 4) for following hosts:testhost

2007-11-21 09:46:18 INFO: execute Multi method configuration 1 (configmanager).
2007-11-21 09:46:18 createconfig for configmanager(configid=1)!
2007-11-21 09:46:18 exec_background(scp username@testhost:flash:\config.text \data\testhostscp.txt) for following hosts:testhost
As you can see, some times it takes slash, sometimes backslash. I have no clue how this comes...
by the way, I am running gentoo linux, kernel 2.6.17.

ranug
ranug
Posts: 16
Joined: Tue Jul 03, 2007 12:55 pm
Location: Austria

Post by ranug »

Are there maybe other linux users using this plugin and can help? I can't image that I'm the only one with this problem.

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

Post by pepj »

ranug wrote:Are there maybe other linux users using this plugin and can help? I can't image that I'm the only one with this problem.
Hello I have found about your \. It is only a cosmetic bug, the command is in fact normally executed executed without \.

in line 251 of file "configmanager_gateway_method_multi.php". The debug sentence show the line always / as \
please replace

Code: Select all

	                $parametersnopassword= preg_replace($searchslash,$replaceslash,$parametersnopassword);
into

Code: Select all

	                if ($config["cacti_server_os"] == "win32") $parametersnopassword= preg_replace($searchslash,$replaceslash,$parametersnopassword);
Now we have to know if your programm has been executed or not (check also the executable-rights)
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 »

pepj wrote:
ranug wrote:Are there maybe other linux users using this plugin and can help? I can't image that I'm the only one with this problem.
Hello I have found about your \. It is only a cosmetic bug, the command is in fact normally executed executed without \.

in line 251 of file "configmanager_gateway_method_multi.php". The debug sentence show the line always / as \
please replace

Code: Select all

	                $parametersnopassword= preg_replace($searchslash,$replaceslash,$parametersnopassword);
with

Code: Select all

	                if ($config["cacti_server_os"] == "win32") $parametersnopassword= preg_replace($searchslash,$replaceslash,$parametersnopassword);
Now we have to know if your programm has been executed or not (check also the executable-rights)
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
ranug
Posts: 16
Joined: Tue Jul 03, 2007 12:55 pm
Location: Austria

Re:

Post by ranug »

Hi pepj,

I cant get any result from my config scheduler even if I write "echo test > %g%/test.txt" into command field. no success.

The log output seems okay:
2007-11-22 17:17:20 exec_background(echo test > /tmp/test.txt) for following hosts:testhost

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

Re:

Post by pepj »

ranug wrote:Hi pepj,
I cant get any result from my config scheduler even if I write "echo test > %g%/test.txt" into command field. no success.
The log output seems okay:
2007-11-22 17:17:20 exec_background(echo test > /tmp/test.txt) for following hosts:testhost
The function of cacti exec_background expect a program or script as first parameter not a command line.
In your case the echo has been excuted but with "test > /tmp/test.txt" as parameter (not redirection).

Try again with a shell script ex: test.sh for ex. like

Code: Select all

echo $1 > $2
exit
in the configmanager command insert for example "csh test.sh "this is a test" /tmp/test.txt

PS: the advantage of exec_background is cacti can start the tasks in background and php timeout will not stop the task.
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:

Post by pepj »

pepj wrote:
ranug wrote:Hi pepj,
I cant get any result from my config scheduler even if I write "echo test > %g%/test.txt" into command field. no success.
The log output seems okay:
2007-11-22 17:17:20 exec_background(echo test > /tmp/test.txt) for following hosts:testhost
The function of cacti exec_background expect a program or script as first parameter not a command line.
In your case the echo has been excuted but with "test > /tmp/test.txt" as parameter (not redirection).

Try again with a shell script ex: test.sh for ex. like

Code: Select all

echo $1 > $2
exit
in the configmanager command insert for example csh test.sh "this is a test" /tmp/test.txt

PS: the advantage of exec_background is cacti can start the tasks in background and php timeout will not stop the task.
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
ranug
Posts: 16
Joined: Tue Jul 03, 2007 12:55 pm
Location: Austria

Post by ranug »

I did what you proposed. It worked. But the most annoying thing is that I can't see any error message before. Neither in /var/log/messages nor in cacti log nor in cfgmng_logfile.txt. There was no message about missing things.

I will do further tests to get my expect script running...

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

Post by pepj »

ranug wrote:I did what you proposed. It worked. But the most annoying thing is that I can't see any error message before. Neither in /var/log/messages nor in cacti log nor in cfgmng_logfile.txt. There was no message about missing things.
I will do further tests to get my expect script running...
- configmanager & cacti can not receive the state of your script ....
- Could you upload your script ?
- I have see now that you give ">" in the parameter list !!! exec_background interprets this not as deviation. Try doing this ">" in your script like in the example with echo ...
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
ranug
Posts: 16
Joined: Tue Jul 03, 2007 12:55 pm
Location: Austria

Post by ranug »

My expect script is working now and produce output like I want. There are still some issues with parameters to expect-script but I think I can work it out. When I'm finished I will provide the whole script because I think expect is the better solution than autouser or scp.

Thanks again,
ranug
shahbour
Posts: 16
Joined: Fri Nov 30, 2007 6:35 pm

Re: Configmanager v6, what to do next, missing something

Post by shahbour »

zheka wrote:
Hi Jean-Michel!

I'm a bit closer to the solution, thanks to you man, you rock.
My problem was with the user name running tftp daemon. Having it resolved I was able to save config files from CISCO devices manually.
Hello i am using SuSE enterprise server yast2-tftpserver.

and it seems i am getting same problem the configuration file is not working ,it is always empty and not created.

Can you please tell me what u did for the tftp server user, how did u solve it.

i tried teh debug issue above but same thing, what do u mean by executable, to what file it should be added, another issue should i create the data folder in tftp or the script should create it as i think, cos it is not doing so now.
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Re: Configmanager v6, what to do next, missing something

Post by pepj »

shahbour wrote: it seems i am getting same problem the configuration file is not working ,it is always empty and not created.
1/ please more information about what you do and insert .

2/ is your config "active" (not paused)
3/ did you insert some hosts

PS: localhost is not possible because the switch/router will try to use localhost as tftp server ... it is itself and will do no download ... insert an IP which can be reached from switch
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
shahbour
Posts: 16
Joined: Fri Nov 30, 2007 6:35 pm

Re: Configmanager v6, what to do next, missing something

Post by shahbour »

pepj wrote:
1/ please more information about what you do and insert .
I installed the plugin normalling and i put the real IP of my machine which contain TFTP and cacti, so i am not getting error when trying to add a new configuration, path for data and configuration is /tftpboot/data.

when i click on show file it is always empty and when i go there i didn't find any file
pepj wrote: 2/ is your config "active" (not paused)
yes it is active
pepj wrote: 3/ did you insert some hosts
yes
pepj wrote: PS: localhost is not possible because the switch/router will try to use localhost as tftp server ... it is itself and will do no download ... insert an IP which can be reached from switch
yes i am using the real ip.

Is there a way i can debug so i can get more info where is the problem i tried to add debug but i didn't find any info, and will the plugin create the folder Data in tftp root, cos it didn't and i did it manually.

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

Re: Configmanager v6, what to do next, missing something

Post by pepj »

shahbour wrote:
1/ I need more information about what you do and insert.
2/ Can you give some printscreens?
3/ Do you want use this with pancho or "pure PHP" ?
4/ Do you have had some hosts ?
5/ some paths are important (not important for method multi):
- TFTP path ("cacti settings" Tab "Up/Download Config Manager") tftp rootpathname
- either "data default path" from ("cacti settings" Tab "Up/Download Config Manager") or "path for the data" from your config
- either "configurations file default path" from ("cacti settings" Tab "Up/Download Config Manager") or "path for configurations files" from your config

PS: you can active the debug in cacti settings (Tab Up/Download Config Manager) and select the option "debug mode". But I don't think this will give something because you have a problem before the poller execution.
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
shahbour
Posts: 16
Joined: Fri Nov 30, 2007 6:35 pm

Re: Configmanager v6, what to do next, missing something

Post by shahbour »

1/ I need more information about what you do and insert.
i didn't get you here but what i do , i create a configmanage and activate it then add hosts then check for the file and it is empty. i will try to post some screen shots hope it make it easier.
2/ Can you give some printscreens?
please find them attached.
3/ Do you want use this with pancho or "pure PHP" ?
i am trying to use pancho , please advice me which is better.
4/ Do you have had some hosts ?
yes i added one host.
5/ some paths are important (not important for method multi):
- TFTP path ("cacti settings" Tab "Up/Download Config Manager") tftp rootpathname
/tftpboot/
- either "data default path" from ("cacti settings" Tab "Up/Download Config Manager") or "path for the data" from your config
/tftpboot/data i tried before /data only
- either "configurations file default path" from ("cacti settings" Tab "Up/Download Config Manager") or "path for configurations files" from your config
/tftpboot/data i am using same path also before i tried .data

PS: you can active the debug in cacti settings (Tab Up/Download Config Manager) and select the option "debug mode". But I don't think this will give something because you have a problem before the poller execution.
Attachments
attach.tar.gz
please find the images attached
(802.97 KiB) Downloaded 255 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest