The Sigar API provides a portable interface for gathering system information such as:
- System memory, swap, cpu, load average, uptime, logins
- Per-process memory, cpu, credential info, state, arguments, environment, open files
- File system detection and metrics
- Network interface detection, configuration info and metrics
- TCP and UDP connection tables
- Network route table
This information is available in most operating systems, but each OS has their own way(s) providing it.
SIGAR provides developers with one API to access this information regardless of the underlying platform.
The core API is implemented in pure C with bindings currently implemented for Java, Perl, Ruby, Python, Erlang, PHP and C#.
The following platforms are currently supported:
|Operating System||Architecture||Versions||Binary Included|
|Linux||x86||2.2, 2.4, 2.6 kernels|
|Windows||x86||NT 4.0, 2000 Pro/Server, 2003 Server, XP, Vista, 2008 Server, 7|
|Windows||x64||2003 Server, Vista, 2008 Server, 7|
|Solaris||sparc-32||2.6, 7, 8, 9, 10|
|Solaris||x86||8, 9, 10|
|AIX||ppc||4.3, 5.1, 5.2, 5.3, 6.1|
|Mac OS X||PowerPC||10.3, 10.4|
|Mac OS X||x86||10.4, 10.5, 10.6|
|Mac OS X||x64||10.5, 10.6|
While SIGAR only depends on the Linux kernel version, the following distributions have been certified:
|Red Hat||6.2, 7.3, 8.0, 9.0|
|RHEL||3, 4, 5, 6|
|CentOS||3, 4, 5|
|Fedora||2, 3, 4, 5, 6, 7, 8, 9, 10|
|SuSE||8, 9, 10, 11|
|Ubuntu||6.06, 8.04, 8.10, 9.04|
|Debian||2.6, 3.0, 3.1, 3.2, 4.0, 5.0|
|VMware ESX||2.x, 3.0|
|XenServer||3.1, 3.2, 4.0, 4.1, 5.0|
To test drive run the following command:
The shell and commands are implemented in Java, the source code is located in
Including implementations of well-known commands such as:
Perl, Ruby, Python, Erlang, PHP and C# interfaces are still a work in progress.
To try the Perl examples:
SIGAR is licensed under the Apache License, Version 2.0
The SIGAR binary distribution contains the following files in sigar-bin/lib:
|sigar.jar||Java||Java API||Yes (for Java only)|
|log4j.jar||Java||Java logging API||No|
|libsigar-x86-linux.so||C||Linux AMD/Intel 32-bit||*|
|libsigar-amd64-linux.so||C||Linux AMD/Intel 64-bit||*|
|libsigar-ppc-linux.so||C||Linux PowerPC 32-bit||*|
|libsigar-ppc64-linux.so||C||Linux PowerPC 64-bit||*|
|libsigar-ia64-linux.so||C||Linux Itanium 64-bit||*|
|libsigar-s390x-linux.so||C||Linux zSeries 64-bit||*|
|sigar-x86-winnt.dll||C||Windows AMD/Intel 32-bit||*|
|sigar-amd64-winnt.dll||C||Windows AMD/Intel 64-bit||*|
|libsigar-ppc-aix-5.so||C||AIX PowerPC 32-bit||*|
|libsigar-ppc64-aix-5.so||C||AIX PowerPC 64-bit||*|
|libsigar-pa-hpux-11.sl||C||HP-UX PA-RISC 32-bit||*|
|libsigar-ia64-hpux-11.sl||C||HP-UX Itanium 64-bt||*|
|libsigar-sparc-solaris.so||C||Solaris Sparc 32-bit||*|
|libsigar-sparc64-solaris.so||C||Solaris Sparc 64-bit||*|
|libsigar-x86-solaris.so||C||Solaris AMD/Intel 32-bit||*|
|libsigar-amd64-solaris.so||C||Solaris AMD/Intel 64-bit||*|
|libsigar-universal-macosx.dylib||C||Mac OS X PowerPC/Intel 32-bit||*|
|libsigar-universal64-macosx.dylib||C||Mac OS X PowerPC/Intel 64-bit||*|
|libsigar-x86-freebsd-5.so||C||FreeBSD 5.x AMD/Intel 32-bit||*|
|libsigar-x86-freebsd-6.so||C||FreeBSD 6.x AMD/Intel 64-bit||*|
|libsigar-amd64-freebsd-6.so||C||FreeBSD 6.x AMD/Intel 64-bit||*|
|* == Required to run on listed OS + Architecture combo|
For example, minimal requirements to use the SIGAR Java API on Windows would be sigar.jar and sigar-x86-winnt.dll
SIGAR uses a common versioning scheme: major.minor[.revision[.build]]
The minor number is incremented when binary compatibility is broken between the .jar and the native libraries. This can happen if a new API function is added or a field is added to an existing one. The revision number is incremented for bug fixes or enhancements specific to the .jar or a specific native library. For example, an issue where memory metrics were incorrect on Solaris machines with 8GB of RAM. Such as change does not impact the interaction between sigar.jar and the native library. The build number is generated by the Hudson CI system and is unlikely to be the same across all binaries.
SIGAR binary and source release packages are available from sourceforge.
The current stable release is version 1.6.4.
Note that the 1.6.x releases are focused on the C and Java APIs. The 1.7 release of SIGAR improves on other language bindings: Ruby, Python and Perl. We recommend using the sigar.git master branch for these language bindings until 1.7 is released.
The SIGAR master Git repository is hosted on github and can be checked out using:
To use the stable branch:
Subversion users can checkout a mirror of the stable branch via:
The development/unstable mirror is available in the trunk:
The native library, Java JNI bindings and Java classes are built using the same build system which has the following requirements:
- JDK 1.4 or higher
- Ant 1.6.5 or higher
- Perl 5.6.1 or higher
- C compiler
Perl is required to generate much of the JNI code as well as many of the Java classes. The ant build system uses a modified version of
cpptasks which works on all platforms supported by SIGAR. The native library can be used by the following languages:
- Java (sigar.jar auto-loads the native library)
- Perl (requires bindings/perl build)
- .NET C# (requires bindings/csharp build)
- Ruby (requires bindings/ruby build)
- Python (requires bindings/python build)
- PHP (requires bindings/php build)
- Erlang (requires bindings/erl build)
The native library includes Java_org_hyperic_sigar_* functions, however there are no JRE dependencies for pure C/C++ applications using SIGAR. The Java JNI interface uses runtime linking and a function-pointer interface which allows us to combine both the sigar_ C API and JNI implementations into a single library. If this is not desirable, it would be trivial to have your own project build system simply compile src/*.c and src/os/$osname/*.c, then link the object files directly into your library or application.
- SIGAR Users Forum | firstname.lastname@example.org
- SIGAR Developers Forum | email@example.com
SIGAR was designed and implemented by Doug MacEachern at Covalent Technologies starting in September of 2002 and has continued with Hyperic as a core component of the HQ product.
SIGAR is not the first attempt to provide a cross-platform API to collect system information. In fact, SIGAR was inspired by libgtop which has been around since 1998 or so and was at version 1.90 when the SIGAR project was started. Doug released a Perl interface to libgtop in December of 1999 upon which Stas Bekman implemented Apache::VMonitor.
Based on that experience, Doug had become a big fan of the libgtop concept, but in practice only had success using it on Linux and with some struggles on Solaris. At the time the SIGAR implementation decision was made, libgtop had become a GNOME component for which there only appeared to be ongoing support for Linux and did not have implementations for other required platforms such as Windows, HP-UX, AIX and Mac OS X. Another requirement was a thread-safe Java interface and the ability to ship a single package containing binaries for all supported platforms. Long story short, libgtop was not the right fit for the requirements but the concept was: An abstract interface defined by C structures and function prototypes with an underlying implementation for each platform to gather the data. So that concept was borrowed, but the implementation was done from scratch and has continued to evolve over the years with broader platform support, more features and language bindings.