Re: [PHP] CPU Usage
Actually, yes there is :) Do a google for phpsysinfo - that's exactly what you want, I guarantee it :) Patrick On Thu, 2005-08-11 at 22:22 +0200, Evert | Rooftop wrote: Hi All, Is there a way to determine the current cpu usage using PHP. I'm mainly looking for a linux solution, but I would like to expand it to windows later on. Any ideas? The archives weren't any good =( Thanks, Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Gathering CPU info from Linux and FreeBSD and placing it into a MySQL db
Hey all, First time poster to this mailing list, but I've been lurking for a week now, and it seems like there are a lot of helpful people on this list. I hope to help others out with problems I can answer for them in the future. Now, I have an important task at hand. My company has assigned me to write a script that will log into both our BSD and Linux boxes (we have about 400 boxes), gather up all the information about each system (Operating System, External IP Address, LAN Controller, Video Card, USB devices, Serial Port, Amount of Memory, # of Hard Drives, HD Brand, and HD Type (ide ata scsi raid)). We've gone over a few ideas, although we're not set in stone which route we want to take, or if there is an easier solution to this task at hand. Heck, even if there is something that has already been coded and can act as a foundation for this project would be grand. Okay, so here's what we've come up with so far: 1) Using parts of PHPSysInfo - Hack apart this script I found called phpsysinfo. I've already hacked it apart and it only displays what we're looking for. You can see what I'm talking about if you visit http://morano.hopto.org/phpsysinfo/index.php - Use the XML portion of the script to export all gathered data into an XML file. - Take the XML file and import it into the MySQL db 2) Finding a script that already does all this already (Ideal Solution) - I'm open to ideas on this one. After snooping around Linux and BSD, I've gathered that using a combination of sysctl, uname, and dmesg would get me the results I need, but this seems like the hard way, unless someone has already implemented a solution using these tools and PHP. Finding a script that already does everything I want IS the ideal solution, the trouble is finding it. I know it can be done, but I've been bashing my head against the wall for the past day and a half now. My head hurts and has a couple knots due to the wall being so thick, so now I turn to you folks in search for some guidance. If there is anything else I can answer to help clarify my task at hand, please let me know. I'm stepping out for lunch, but I'm pretty much stuck at work until a solution has been found, so I'll be checking the mailing list frequently (about every 5 mins!). The URL I provided to contains everything that is needed to be gathered. Also, if there are other resources such as forums, web site tutorials, script archives, etc. that I might be able to find answers from, I'd love to check them out. Thanks in advance. Patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Gathering CPU info from Linux and FreeBSD and placing it into aMySQL db
Hi Nate, We are a hosting company. We use this Mambo-like CMS called CATS, which pretty much tells us what company owns what server(s) in our data centers. CATS will provide us with a list of details on the specs for each machine they own, which include the specs I listed (memory, # of cpus, etc.) Someone in our company deleted the table within the MySQL db that listed our 400+ machines. Since IT is slammed with other tasks, they have assigned me to this job. This is a step by step as to what I've decided needs to happen, in order for this task to operate (somewhat) smoothly. 1) Read IP addresses from a tab-delimited file, which will follow the format: abc.com 64.64.64.1 domain.com 255.213.6.4 blah.co.uk 29.42.200.9 etc.net 13.14.15.255 2) Assign the $domain variable to the domain name in each line, then assign $ipaddress to the actual ip address 3) Take $ipaddress and ssh into each box (we have a private/public ssh key set up) 4) (This is the undecided step) Run script to gather the necessary server information and export info into either a)CSV or b)XML 5) Take exported file and upload it/email it to my box/my email address 6) Take exported file and create a script to import the information into the CATS MySQL db (not handled by me, but I can easily take over responsibility on creating this script and implement it into my code) 7) Lather, rinse, repeat :) Hope this helps to clear up some information. I got more answers to any questions anyone might have. Thanks again :) Patrick On Wed, 2005-08-10 at 16:41 -0400, Nathan Tobik wrote: Can I ask why you are trying to write a script that from what I understand goes to each box to retrieve the data instead of pushing the data to the central db? You could write a little script in PHP that gathers the required information and then does an insert into your database. Then from the database you can create a webpage that is a view of all of your machines. On the local machine you can schedule your script to run every X minutes via crontab. If I misread your email and headed down the wrong path please let me know. Nate Tobik (412)661-5700 x206 VigilantMinds snip... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gathering CPU info from Linux and FreeBSD and placing it into aMySQL db
Hi Greg, Thanks for the link, although I don't think this is exactly what I am looking for. I am looking for a rather simple way to automate the ssh into each box and gathering of the system information, instead of monitoring the servers. This is going to be a one time operation, as once we gather all the information, regular backups will (finally) be made so this won't happen again in the future. With this now being my 2nd week into the job, I'm learning that the new people who just joined the company are replacing the rather unorganized people who have thrown us into this rut. Thanks again for the link (that's a rather cool piece of software!), but I think I'm looking for something a tad more simple. Got any more links to throw at me? :) Patrick On Wed, 2005-08-10 at 16:13 -0500, Greg Donald wrote: On 8/10/05, Patrick - Jupiter Hosting [EMAIL PROTECTED] wrote: Hi Nate, We are a hosting company. We use this Mambo-like CMS called CATS, which pretty much tells us what company owns what server(s) in our data centers. CATS will provide us with a list of details on the specs for each machine they own, which include the specs I listed (memory, # of cpus, etc.) Someone in our company deleted the table within the MySQL db that listed our 400+ machines. Since IT is slammed with other tasks, they have assigned me to this job. Sounds like you want Nagios. http://www.nagios.org/ -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php