https://github.com/stjohnjohnson/cgroup-stats
Node Module for reading CGroup stats
https://github.com/stjohnjohnson/cgroup-stats
Last synced: 8 months ago
JSON representation
Node Module for reading CGroup stats
- Host: GitHub
- URL: https://github.com/stjohnjohnson/cgroup-stats
- Owner: stjohnjohnson
- License: mit
- Archived: true
- Created: 2015-12-30T21:23:47.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-19T15:33:12.000Z (over 10 years ago)
- Last Synced: 2025-10-09T14:44:14.822Z (8 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/cgroup-stats
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cgroup-stats
[](https://www.npmjs.com/package/cgroup-stats)
[](https://www.npmjs.com/package/cgroup-stats)
[](https://app.wercker.com/project/bykey/69dad692abfba7ef1f1cdcbd1d162792)
[](https://github.com/stjohnjohnson/cgroup-stats/blob/master/LICENSE)
Node Module for reading [Control Group][cgroup] usage stats
Currently this reads the following data:
- [memory.usage_in_bytes][memory] - current usage for memory
- [memory.max_usage_in_bytes][memory] - max memory usage recorded
- [cpuacct.stat.user][cpuacct] - time spent by tasks of the cgroup in user mode
- [cpuacct.stat.system][cpuacct] - time spent by tasks of the cgroup in kernel mode
**This only works on Linux operating systems**
## Usage
```javascript
var cgroupStats = require('cgroup-stats');
cgroupStats(function (error, data) {
console.log(data.memory.usage_in_bytes);
console.log(data.memory.max_usage_in_bytes);
console.log(data.cpuacct.stat.user);
console.log(data.cpuacct.stat.system);
});
```
## License
Code licensed under the MIT license. See `LICENSE` file for terms.
[cgroup]: https://en.wikipedia.org/wiki/Cgroups
[memory]: https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
[cpuacct]: https://www.kernel.org/doc/Documentation/cgroup-v1/cpuacct.txt