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    


Cactid on Windows
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions
Author Message
dieter
Cacti User


Joined: 20 Feb 2004
Posts: 164

PostPosted: Sat May 15, 2004 7:45 pm    Post subject: Reply with quote

if popen is causing the problem, then maybe this is why? :

if you open more then 1 pipe, he begins to mix up which output has to go to which opened pipe? Or am I wrong? Maybe I'm wrong because you use pointers to remember the pipe...

what does thread_mutex_lock(LOCK_PIPE); mean?

Or is it not the popen from c++ causing the problem but the popen from within a PHP script called by cactid?
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Mon May 17, 2004 12:24 pm    Post subject: Reply with quote

Reading between the lines, yes, this is a very complicated problem. I am going to attempt to compile RRD under Windows CYGWIN to resolve the POPEN issue with the tool...

TheWitness
Back to top
sidewinder
Cacti User


Joined: 06 Dec 2003
Posts: 66
Location: Winchester, MA

PostPosted: Wed Jun 02, 2004 5:33 pm    Post subject: Reply with quote

well, usually every time on this subject, it breaks. Maybe this post will be the ultimate test.

I've been running 10 threads for over 48 hours with no problems. Basically what i did was make sure that all of my scripts call exit when they finish (exit 0. Perhaps you all could do the same and verify my findings.

Cheers,

Phil
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Wed Jun 02, 2004 7:43 pm    Post subject: Reply with quote

Are you running the hostmib php scripts? I changed the code as you had suggested and this did not correct the problem. The only scripts that I am calling are the php hostmibs.

TheWitness
Back to top
sidewinder
Cacti User


Joined: 06 Dec 2003
Posts: 66
Location: Winchester, MA

PostPosted: Thu Jun 03, 2004 3:12 am    Post subject: Reply with quote

No, all of the scripts i am running are in perl.
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Fri Jun 04, 2004 4:22 am    Post subject: Reply with quote

Sidewinder,

That is a very important note. I believe that php 4.3.6 is having some difficulty with performance under Cactid with respect to the POPEN command, even in thread safe mode. I am not quite adept enough to figure it out however. As with many of the users of Cacti, it is a part time hobby.

Question, are you performing any of the HostMib like queries using perl. If so, would you be prepared to post for the general good?

Larry
Back to top
sidewinder
Cacti User


Joined: 06 Dec 2003
Posts: 66
Location: Winchester, MA

PostPosted: Fri Jun 04, 2004 5:23 pm    Post subject: Reply with quote

I can't say that i am using any host mib queries in perl, otherwise i would be more than happy to share them. If your monitoring any windows boxes i had posted some perl scripts that use WMI a while back, there in the scripts and addons section. They are pretty extensible, although the supplied doc doesn't really explain it that well. If you tweak them the right way they can be used as indexed queries too.

I do have another piece of the catid problem puzzle, it appears as though the main cactid thread finishes early. What i observed is that the the "db_insert(&mysql, "replace into settings (name,value) values ('date',NOW())");" was occurring well before the entire poller cache was processed. I suspect it is finishing after all of the snmp polling functions are complete. This seems to leave a dangling thread that was processing the script queries. It can be verified by comparing the date in the settings table "select * from settings where name='date'" to the processlist of the host while cactid is running. I also started running cacti on freebsd and have a large poller cache (3 - 4 minutes to complete), so this was a lot easier to see. This behaviour only seems to happen when there are script queries in the poller cache and not when running only SNMP queries. Gonna look at the code, but i'm not that C savvy and threads just add to the complexity.

Cheers,
-Phil
Back to top
bulek
Cacti Pro User


Joined: 20 May 2002
Posts: 852
Location: Poland

PostPosted: Sun Jun 06, 2004 3:36 pm    Post subject: Reply with quote

I can see three "weak" points in poller.c handling script execution. When I look from line 155 (cacti 0.8.5a) under "case 1:" they are the following:

1.
Quote:
while (fgets(cmd_result, 255, cmd_stdout) != NULL);

This will read the script output line by line storing the last one read in "cmd_result" variable. If for some reason the script prints an extra newline then it will be just empty string instead of results printed in first line of the output.

2.
Quote:
while (fgets(cmd_result, 255, cmd_stdout) != NULL);

In the same statement it is possible to copy 255 characters to buffer which is 255 bytes long (char cmd_result[255]; ). In C you need to reserve one byte more for string ending '\0' character.

3.
Quote:
}else if (cmd_result == "") {

In C you can't compare strings like that. This statement compares pointer to cmd_result string with pointer to "" string which are always different. The alternative would be checking string length with "strlen" function.

And the same for "case 2:" section below. This may be not related to the main problem but should be corrected anyway.

- Piotr
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Sun Jun 06, 2004 4:15 pm    Post subject: Reply with quote

bulek,

UDahMan!!! Am testing right now... Like a needle in a haystack.
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Sun Jun 06, 2004 4:21 pm    Post subject: Reply with quote

No such luck. It was a problem and is now corrected. I am going to rip my hair out on this one...

TheWitness
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Sat Jun 12, 2004 9:45 pm    Post subject: Reply with quote

All,

I have fixed the threading issue in CACTID for Windows. I will post with the 0.8.6 release of Cacti after testing has been completed. The build will still require CYGWIN for now.

I am looking at a distribution that does not require CYGWIN, but it may take a while.

TheWitness
Back to top
Bookmarc



Joined: 07 May 2004
Posts: 18

PostPosted: Thu Jun 17, 2004 3:16 pm    Post subject: Reply with quote

Great!

Sorry to bring this up again but did you find anything for running cactid on windows w/o cygwin ?

That would be great ! Keep up the good work !

thx !
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Thu Jun 17, 2004 6:57 pm    Post subject: Reply with quote

Bookmarc,

If you have either XP Pro, 2003 Server or 2000 Pro/Server, you can download SFU (Services for Unix 3.5) from Microsoft. I understand that it's implementation of POSIX is more stable than CYGWIN's. If you can test under the current version of CACTID and let me know how stable it is, I would greatly appreciate it.

I am currently doing my development under XP home and can not install the product. I have been working with some high end threads programmers that assure me it should work. It is going to take me about a week to get XP Pro on my home PC. Therefore, I will not be able to answer this one right away.

TheWitness
Back to top
guerra6880



Joined: 19 Apr 2004
Posts: 33

PostPosted: Fri Jul 09, 2004 7:04 am    Post subject: Reply with quote

Here is the link to the Windows Services for Unix.

http://www.microsoft.com/windows/sfu/productinfo/overview/default.asp

You have to register for the download and its 217MB! Yikes
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Unstable Development Versions All times are GMT - 5 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 



Powered by phpBB © 2001, 2005 phpBB Group