Page 1 of 1

SNMP from PHP

Posted: Thu Jan 15, 2004 2:50 pm
by batatudo
Hi

I installed NET-SNMP 5.0.8 on my mandrake linux server running apache 4.3.3.

Everything looks OK, but none of the snmp functions in PHP works.
I think I have to enable some module in PHP to activate the SNMP functions,
or maybe is in the Apache. I don't know.

I need help!!!
thanks

bye

Posted: Thu Jan 15, 2004 10:37 pm
by Pyrite
Apache 4.3.3 huh? You're way ahead of me buddy!! :D

But did you read the man page?
http://us2.php.net/manual/en/ref.snmp.php

Btw: Just curious what you want to use SNMP for?

Posted: Fri Jan 16, 2004 7:04 am
by batatudo
Jeje, Sorry Apache is 2.0, and PHP is 4.3.3 anyway...

I read the manual. The manual said this "you need to define NO_ZEROLENGTH_COMMUNITY to 1 before compiling it." I don't know where this variable is defined. anyway I don't have the source code of PHP and don't know how to compile PHP.
I'm new to linux. I came from the dark side "windows".
I know PHP is working but I don't know where is installed, too many strange folders for me.

Any idea?

Posted: Fri Jan 16, 2004 9:28 am
by Pyrite
That's only for UCD_SNMP, but you're using NET SNMP. But in order to enable snmp in php you have to recompile php from source. If I were you, I would uninstall whatever packages you have for php/apache and go read the install guide at:

http://us2.php.net/manual/en/install.apache2.php

When you do the compile php part, you'll add --with-snmp to the configure line.

Once again though, just asking, what do you want/need snmp for?

Posted: Fri Jan 16, 2004 2:28 pm
by batatudo
I need SNMP to get the CPU utilization of another server. I need this for my office.
Example: When a user in my company open the browser they are first connected to the linux server.
From there they click the link "Reprorts". Then the PHP program check two windows 2000 servers and have
to decide which one to redirect the user. That part is very easy, if the first server is down then redirect
to the second server. But I also want to make what I call "low balance". If the two servers are online, the
PHP program has to decide who are less busy. I know I can make this works tracking the users in a MYSQL table,
but there is more services running on these widows servers and I have no control over them.

How I compile PHP?
I'm using mandrake 9.2 and everything was installed at setup.

bye

Posted: Fri Jan 16, 2004 6:01 pm
by Pyrite
That link I gave you ... read it!

Posted: Wed Feb 04, 2004 11:45 am
by BDKR
batatudo wrote:I need SNMP to get the CPU utilization of another server. I need this for my office.
Example: When a user in my company open the browser they are first connected to the linux server.
From there they click the link "Reprorts". Then the PHP program check two windows 2000 servers and have
to decide which one to redirect the user. That part is very easy, if the first server is down then redirect
to the second server. But I also want to make what I call "low balance". If the two servers are online, the
PHP program has to decide who are less busy. I know I can make this works tracking the users in a MYSQL table,
but there is more services running on these widows servers and I have no control over them.

How I compile PHP?
I'm using mandrake 9.2 and everything was installed at setup.

bye
It sounds to me you are talking about load balancing. If that's the case, this really isn't the correct way to do it. Normally, there is a machine that acts as a traffic manager and directs the process or request to a machine amongst a pool of machines. 2 machines are enough to qualify as a pool.

Anyway, the method you describe will invoke a good deal more overhead into the overall processing of an individual request than should ever be needed. With one machine acting as a cluster manager or traffic manager, it will have the overhead of deciding where to send the next request. And it's really not all that hard.

Do your homework on load balancing. There is also the open source project called Piranha, which is a load balancing / cluster solution.

Cheers,
BDKR