Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


help with translating template/script from linux to windows

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Windows Specific
Author Message
Froz



Joined: 26 Aug 2008
Posts: 19

PostPosted: Thu Aug 28, 2008 4:21 pm    Post subject: help with translating template/script from linux to windows Reply with quote

I've been working on a win32 cacti build for the whole week. The build currently monitors the localhost network statistics etc, without any issues.

I've been trying to get the fibrealliance san switch script/template to work on a win32 http://forums.cacti.net/viewtopic.php?t=15797&highlight=fiber+alliance

The scripts were created on 8.6 and have been updated for 8.7b. I've attached everything here for reference as well.

I have [temporary] access to a linux cacti install:
Cacti Ver: 0.8.7.b
Cacti OS: Unix
SNMP Version: net-snmp ver 5.3.0.1
RRDTool Version: RRDTool 1.2.x
Poller Type: Spine
PHP: 5.2.5 512mb of mem
Apache/2.2.3 (Linux/SUSE)

The scripts/graphs work like a charm on linux.

My win32 install:
Cacti Ver: 0.8.7.b
Cacti OS: win32
SNMP Version: net-snmp
RRDTool Version: RRDTool 1.2.x
Poller Type: Spine (tried previous with cmd)
PHP: 4.4.9 (I have tried 5.2.6 as well)
IIS 6.0

Under the snmp category it says ucd-snmp support enabled and ucd-snmp-4.2.3. On the linux box it says net-snmp under the snmp category. Perhaps this is my problem...though I followed all of the instructions to install net-snmp that I could find.

On my win32 machine, the poller cache for one data type is:
Script: E:\php449\php.exe -q e:\cacti\scripts\query_mds9020_san_portinfo.php 10.68.1.14 public 1 get 3txframe 19

I can copy that syntax and paste it into a cmd line and it works great. So it doesn't feel like it's a script problem. The cacti log is showing this however:

08/28/2008 04:17:02 PM - SPINE: Poller[0] Host[6] DS[190] WARNING: Result from SCRIPT not valid. Partial Result: ...

I'm stuck, and appreciate any thoughts.

Thanks,



cacti_data_query_san_switch_port_statistics_173.xml
 Description:
template

Download
 Filename:  cacti_data_query_san_switch_port_statistics_173.xml
 Filesize:  100.1 KB
 Downloaded:  55 Time(s)


query_mds9020_san_portinfo.zip
 Description:
script

Download
 Filename:  query_mds9020_san_portinfo.zip
 Filesize:  1.4 KB
 Downloaded:  24 Time(s)


san_port.xml
 Description:
script query

Download
 Filename:  san_port.xml
 Filesize:  3.43 KB
 Downloaded:  29 Time(s)

Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6795
Location: WA, USA

PostPosted: Thu Aug 28, 2008 7:45 pm    Post subject: Reply with quote

1) when working with scripting issues, ALWAYS try with the cmd.php too. Spine is a fickle beast at times.

2) Spine requires the FULL PATH of the executing binary, not just the executable, so try adding E:\php449\php.exe into the data input method.
Back to top
Froz



Joined: 26 Aug 2008
Posts: 19

PostPosted: Wed Sep 03, 2008 11:13 am    Post subject: Reply with quote

I started off with cmd.php but no dice.

It's a data query so I've edited the xml file to point to the specific path but no luck there either.

I exported the data query w/dependencies from the linux box and now instead of NAN's, I get 000's. The cacti log still says not valid/partial result. Is there a way to get actual result in the log file?

One other difference is the linux box is a 64bit server, and the windows is 32bit. Any reason why that would matter?




BSOD2600 wrote:
1) when working with scripting issues, ALWAYS try with the cmd.php too. Spine is a fickle beast at times.

2) Spine requires the FULL PATH of the executing binary, not just the executable, so try adding E:\php449\php.exe into the data input method.
Back to top
Froz



Joined: 26 Aug 2008
Posts: 19

PostPosted: Wed Sep 03, 2008 1:54 pm    Post subject: Reply with quote

Alrighty, I was able to export the data query from linux and import it into windows. It started logging 000's which was new, so I went back to cmd.php and now I get data.

Now I wonder why spine isn't working.
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6795
Location: WA, USA

PostPosted: Wed Sep 03, 2008 3:19 pm    Post subject: Reply with quote

When you turn the logging level to debug for both spine/cmd and watch your script run, anything useful outputted to help figure out the difference?

The difference between 64 and 32bit shouldn't matter for cacti itself, but it might for the rrd files (check the rrdtool manual / mailing list). I know you cannot use linux created rrd files on windows, or visa-versa.
Back to top
Froz



Joined: 26 Aug 2008
Posts: 19

PostPosted: Wed Sep 03, 2008 3:35 pm    Post subject: Reply with quote

and the saga continues. while cmd.php will work for 1 port. i tried to add 12 others. (idea is to get to thousands) and it takes 2 min 38 seconds. that surely won't scale. ;(
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6795
Location: WA, USA

PostPosted: Wed Sep 03, 2008 4:30 pm    Post subject: Reply with quote

2 min per query? yikes, something is not set up correctly. When you run the script manually from the commandline, does it take that long? How many pollers / threads do you have configured in cacti?

You might consider converting your script to using the PHP script server: http://docs.cacti.net/?q=node/514
Back to top
Froz



Joined: 26 Aug 2008
Posts: 19

PostPosted: Wed Sep 03, 2008 5:58 pm    Post subject: Reply with quote

EDIT: I my have misinterpted the script server. I tried to run cmd.php specifically and received the below errors but it does look like it is collecting data. Looks like each get statement is taking 2 seconds when I look at the cacti logs.

Another interesting side note is that I can now us Spine, but it doesn't appear to be significantly faster. I was able to get down to 1min 54 seconds to pull the 21 test ports that used to take 2 min 38 seconds.

/EDIT:

It takes about 2-3 seconds per stat/port ( 3 stats/port). the result comes back very quickly but the script is still held open by php. it's very wierd.

I've tried different pollers/threads but I'm unsure as to how to correctly size it. Looking for a guide on that yet. I'm running this on a ibm ls20, 4gb ram, 2xdual core amd 2.2ghz.

Just converted that script to a script server query. Used the testing example, was able to correctly run a get, but now the poller is showing invalid again. it is significantly faster though


09/03/2008 05:54:11 PM - CMDPHP: Poller[0] Host[11] DS[264] WARNING: Result from SERVER not valid. Partial Result:

09/03/2008 05:54:11 PM - CMDPHP: Poller[0] Host[11] DS[264] SERVER: E:\cacti\scripts\ss_query_mds9020_san_portinfo.php ss_myfunction 10.68.1.14 public 1 get 3rxframe 19, output: U

09/03/2008 05:54:11 PM - CMDPHP: Poller[0] Host[11] DS[264] WARNING: Result from SERVER not valid. Partial Result:

09/03/2008 05:54:11 PM - CMDPHP: Poller[0] Host[11] DS[264] SERVER: E:\cacti\scripts\ss_query_mds9020_san_portinfo.php ss_myfunction 10.68.1.14 public 1 get 3txframe 19, output: U

09/03/2008 05:54:11 PM - CMDPHP: Poller[0] Host[11] DS[264] WARNING: Result from SERVER not valid. Partial Result:
09/03/2008 05:54:11 PM - CMDPHP: Poller[0] Host[11] DS[264] SERVER:

E:\cacti\scripts\ss_query_mds9020_san_portinfo.php ss_myfunction 10.68.1.14 public 1 get 3discard 19, output: U

from the command line

[UTWMAD0P0698] C:\Documents and Settings\mckeerc>php e:\cacti/script_server.php

PHP Script Server has Started - Parent is cmd
E:\cacti\scripts\ss_query_mds9020_san_portinfo.php ss_myfunction 10.68.1.14 public 1 get 3rxframe 19
39450841

E:\cacti\scripts\ss_query_mds9020_san_portinfo.php ss_myfunction 10.68.1.14 public 1 get 3txframe 19
22547159

E:\cacti\scripts\ss_query_mds9020_san_portinfo.php ss_myfunction 10.68.1.14 public 1 get 3discard 19
0




BSOD2600 wrote:
2 min per query? yikes, something is not set up correctly. When you run the script manually from the commandline, does it take that long? How many pollers / threads do you have configured in cacti?

You might consider converting your script to using the PHP script server: http://docs.cacti.net/?q=node/514
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6795
Location: WA, USA

PostPosted: Wed Sep 03, 2008 8:57 pm    Post subject: Reply with quote

1) There is a thread in the annoucement forum with users reporting their spine/cmd metrics with various configs. Since I'm just a hobbiest, I haven't had the chance to really optimize my Cacti on a decent server.

2) PHP hanging? Using the script server, there should only be 1 php.exe being spawned for your scripts (and others which use the script server).

3) Obviously your script works when manually run, which is good. Try clearning the poller cache and then see if your script works. I assume when you changed the script type, you re-created the appropriate date sources for the device to use the new data input method / data template / rrd files, etc?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Windows Specific All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group