Asked  7 Months ago    Answers:  5   Viewed   43 times

How does VBulletin get the system information without the use of exec? Is there any other information I can get about the server without exec? I am interested in:

  • bandwidth used
  • system type
  • CPU speed/usage/count
  • RAM usage



Use PHPSysInfo library

phpSysInfo is a open source PHP script that displays information about the host being accessed. It will displays things like:

  • Uptime
  • CPU
  • Memory
  • Ethernet
  • Floppy
  • Video Information

It directly parsed parses /proc and does not use exec.

Another way is to use Linfo. It is a very fast cross-platform php script that describes the host server in extreme detail, giving information such as ram usage, disk space, raid arrays, hardware, network cards, kernel, os, samba/cups/truecrypt status, temps, disks, and much more.

Wednesday, March 31, 2021
answered 7 Months ago

The psutil library gives you information about CPU, RAM, etc., on a variety of platforms:

psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by tools like ps, top and Windows task manager.

It currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures, with Python versions from 2.6 to 3.5 (users of Python 2.4 and 2.5 may use 2.1.3 version).

Some examples:

#!/usr/bin/env python
import psutil
# gives a single float value
# gives an object with many fields
# you can convert that object to a dictionary 
# you can have the percentage of used RAM
# you can calculate percentage of available memory
psutil.virtual_memory().available * 100 / psutil.virtual_memory().total

Here's other documentation that provides more concepts and interest concepts:

Tuesday, June 1, 2021
answered 5 Months ago

There is an open source library that gives these (and more system info stuff) across many platforms: SIGAR API

I've used it in fairly large projects and it works fine (except for certain corner cases on OS X etc.)

Wednesday, June 23, 2021
answered 4 Months ago
>>> import os
>>> os.times()
(1.296875, 0.765625, 0.0, 0.0, 0.0)
>>> print os.times.__doc__
times() -> (utime, stime, cutime, cstime, elapsed_time)

Return a tuple of floating point numbers indicating process times.

From the (2.5) manual:

times( )

Return a 5-tuple of floating point numbers indicating accumulated (processor or other) times, in seconds. The items are: user time, system time, children's user time, children's system time, and elapsed real time since a fixed point in the past, in that order. See the Unix manual page times(2) or the corresponding Windows Platform API documentation. Availability: Macintosh, Unix, Windows.

Wednesday, July 28, 2021
answered 3 Months ago

Got it working. Used pretty much the same code as found here: Turns out I had a bad path, which i finally got sorted out: new ManagementPath(string.Format("\{0}rootcimv2",machineName));

Sunday, August 15, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :