HomePHP Retrieving System Information With patSysinfo
Retrieving System Information With patSysinfo
Linux file structure contains within it a special area called /proc. Now, some believe that there's black magic in that directory. For those who know better than to fear the /proc, there awaits much good magic, in the form of server info. Looking for a way to retrieve real-time server information and display it to users in your Web application? Today's your lucky day! Take a look at the patSysinfo PHP class, which lets you do that and a whole lot more.
One of my recent projects involved building the administration interface for a Web hosting company. This interface, primarily targeted at the company's clients, included the usual goodies: creating and deleting user and FTP accounts, configuring email forwards and spam filters, and viewing traffic statistics. One of the more novel aspects of this project, however, involved providing users with real-time server information: server uptime, memory usage, CPU load, number of concurrent users, and so on.
Now, I'd never done something like this before, and I had no idea how to begin obtaining this information "live" from the system. A little research told me all about the /proc filesystem in Linux, and how it contains information on the system state, updated in real time. I played with this a little bit, confirmed that it contained most of the information I needed, and had started writing some code to interface with it when I decided - almost on an impulse - to see if someone had already invented this particular wheel.
Lo and behold, I found patSysinfo, the answer to all my problems (and then some). Flip the page, and let me tell you more!