问题
I'm looking for a library that will provide this type of information:
RAM
Swap space
Number of CPUs
speed (CPU MHz)
Number of cores
Chip type
Ultimately I'll be calling into it from Java, but a C library would be fine, which I can wrap with JNI.
Platforms of interest include, but not limited to, AIX, HP-UX, Solaris, Windows.
Thanks!
回答1:
Like you I was looking for a cross platform system info library and found this:
http://code.google.com/p/geekinfo/
I didn't test it yet but it might suit your needs.
good luck !
回答2:
You can take a look at Sigar which supports the metrics and platforms that you want and has both C and Java APIs. It is GPL, which may or may not suit your needs.
回答3:
Are you looking to query these systems remotely? If so, your best bet will probably be to use an SNMP library.
回答4:
You may want to check out the following documentation site: http://en.wikipedia.org/wiki/Hardware_abstraction_layer
Also check out the Open Audit computer auditing and inventory tracking system http://www.open-audit.org source code and their script for auditing linux machines for examples of querying a hal database.
You may also want to check out the Nagios Plugins project for a large stash of open source scripts for collecting stats remotely from other machines. Nagios is designed as an Enterprise administration / up-time monitoring system for data centers, but the scripts could easily be used standalone for monitoring in different configurations.
来源:https://stackoverflow.com/questions/654643/cross-platform-api-for-system-information