TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-19-2009, 03:02 PM   #1 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default Checking bandwidth and hard drive space of a server

How can I check with php how to get the bandwidth and hard drive space of a server, been wanting to do this for some time with a test project.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-19-2009, 04:22 PM   #2 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Orc View Post
How can I check with php how to get the bandwidth and hard drive space of a server, been wanting to do this for some time with a test project.
You'll have to do this via SNMP protocol. So you have to compile PHP with SNMP libraries so you can make use of SNMPget, SNMP walk functions...
allworknoplay is offline  
Reply With Quote
Old 04-19-2009, 04:57 PM   #3 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
You'll have to do this via SNMP protocol. So you have to compile PHP with SNMP libraries so you can make use of SNMPget, SNMP walk functions...
Theres no way via the php core?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-19-2009, 05:00 PM   #4 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Orc View Post
Theres no way via the php core?

No, PHP doesn't provide libraries for SNMP.

So when you compile PHP you'll have to do something like this:

./configure --prefix=/usr/local/php/ with-snmp=/usr/local/snmp/

I can tell you exactly how to do it if you want.

I've done it a million times....
allworknoplay is offline  
Reply With Quote
Old 04-19-2009, 07:38 PM   #5 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

PHP does however come with the SNMP extension by default, but not enabled by default. But to check the space of the server you could always try and use disk_free_space or something if you aren't in the floppy safe_mode ;)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 04-19-2009, 07:51 PM   #6 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Kalle View Post
PHP does however come with the SNMP extension by default, but not enabled by default. But to check the space of the server you could always try and use disk_free_space or something if you aren't in the floppy safe_mode ;)

What does it mean when you say it comes with SNMP extension by default?
allworknoplay is offline  
Reply With Quote
Old 04-19-2009, 08:12 PM   #7 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
What does it mean when you say it comes with SNMP extension by default?
PHP has an SNMP extension included by default, hence why the --with-snmp configure switch works ;)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 04-19-2009, 08:19 PM   #8 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Kalle View Post
PHP has an SNMP extension included by default, hence why the --with-snmp configure switch works ;)
ohhhh, gotchya.

So that's the same thing with mysql too right?

If you don't compile PHP with mysql, the mysql functions won't work so you have to point it to a mysql directory during compilation right?

--with-mysql=/usr/local/mysql/


Also, I've always wanted to know this, is there any different between these two?


--with-mysql=/usr/local/mysql

and

--with-mysql=/usr/local/mysql/



BTW: check your PM....
allworknoplay is offline  
Reply With Quote
Old 04-19-2009, 11:36 PM   #9 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
ohhhh, gotchya.

So that's the same thing with mysql too right?

If you don't compile PHP with mysql, the mysql functions won't work so you have to point it to a mysql directory during compilation right?

--with-mysql=/usr/local/mysql/


Also, I've always wanted to know this, is there any different between these two?


--with-mysql=/usr/local/mysql

and

--with-mysql=/usr/local/mysql/



BTW: check your PM....
Yep, you have to configure php with directives thats not enabled by default, for example in PHP4 MySQL was built staticlly by default, meaning that doing a "configure" (or on non-Windows: ./configure) would result in MySQL was enabled and set staticlly by default.

Enabled by default in the php work means, that doing a "configure" will result in it being enabled and compiled when running "make" (or nmake on Windows).

As for the last one, there shouldn't be any difference, since they both point to a directory. but there might be some weird issue since Unix would handle it "poorly". But I can't tell for sure, I only do PHP compilations on Windows ;)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 04-20-2009, 02:21 PM   #10 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

disk_free_space not of any use?

For more in depth HD monitoring on the Penguin, you could do this (assuming PHP isn't in safe mode):
PHP Code:
<pre><?php passthru('df -h'); ?></pre>
However that will just dump out the raw output from the df command.
somthing like thus:
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             146G   50G   95G  35% /
/dev/sda1              99M   24M   76M  24% /boot
/home/data            457G  124G  333G  28% /home/data
/home/unix            457G  124G  333G  28% /home/mnt/unix
(note, i trimmed the above down for brevity, depending on your system setup you may get more as i did :))
For bandwidth, you would have to install a program like bmon, MRTG etc

For Redmond, i have absolutely no clue what so ever
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:37 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design