{"_id":"@11ways/process-monitor","name":"@11ways/process-monitor","dist-tags":{"latest":"0.3.1"},"versions":{"0.3.1":{"name":"@11ways/process-monitor","description":"Monitors the CPU and memory usage for a PID or collection of PIDs.","version":"0.3.1","homepage":"https://github.com/skerit/process-monitor","author":{"name":"Modulus","email":"support@modulus.io"},"contributors":[{"name":"Brandon Cannaday","email":"brandon@modulus.io"},{"name":"Matt Hernandez","email":"matt@eventargs.com"},{"name":"Jelle De Loecker","email":"jelle@elevenways.be"}],"repository":{"type":"git","url":"git://github.com/skerit/process-monitor.git"},"bugs":{"url":"https://github.com/skerit/process-monitor/issues"},"licenses":[{"type":"MIT","url":"https://github.com/skerit/process-monitor/blob/master/LICENSE-MIT"}],"main":"./lib/process-monitor","engines":{"node":">= 12.0.0"},"dependencies":{"string":"~3.3.3","stringformat":"~0.0.5","pidusage":"~3.0.0"},"devDependencies":{"docco-husky":"~0.3.3"},"keywords":["process","monitor","pid","ps"],"docco_husky":{"output_dir":"docs","project_name":"Process-Monitor","show_timestamp":false},"gitHead":"6c4091d857803e635b402b2250e085bee214bad3","_id":"@11ways/process-monitor@0.3.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-/6WrUwvzGISs2YvY2ezDfsM+/nVWN1h3ekRSiWsuMiJTP6TgyZmElvKe5f1ScZOZ9fJ1rixxlud8AvgThweMjw==","shasum":"3b29d1851505de47f2aa524556d2f9e46ed398d1","tarball":"https://registry.npmjs.org/@11ways/process-monitor/-/process-monitor-0.3.1.tgz","fileCount":8,"unpackedSize":48311,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDyIm/K4z1+NFCp7wfQTSLBvB+GZV0a33rgwj04AXVFQgIhAIxSFfVd3faw0IOLqXZHKYga2y0XKWiP+xhtbOQT3Ta/"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjQ/vEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrnABAAhrV43NlD8YTyDlSoqPUbb7Bv29GEgq8rbpCqHyKVnuPFH9LD\r\nU0RULkXgrGvzlcpOl9OWIx22a45TiaWDn6rCF1cwmZv4odJ6vAaBKjRadvK/\r\nIk90UTtudwY0/b04//rDaugQEhHRX5PmzuPenMFPpYKaGPwk5t2GMnRLPW5V\r\nGqMZ7b6f3s9dYDmvCahi7cSTyH3Jpm97i0kAPdGrQtpbMeBkgQY6p8nYmw2H\r\nkaOiD4g9l+FzDls31LTYAV6iq6vm3QOgv0qQla5UGP5JjtpnF36/jfwUKeD4\r\ncHNIvIqzB3gh9nELjT2IQG/evtzc/IhVNftIBxREDQrcQGuu+NAtmtvwTldC\r\nzXYtLYXpcm4FMHGFhsAoQfR84yFtlS+Ahv7qUEyFyMD2Y9/NZ8lBFFGt5cR9\r\nKVRzEiB/JnhYrSqnrKOTub2wgHHsmkJ7idtrwpXAxsm5dfv5rFUAuvPZvV7N\r\nZwgxeZV/ydX7Sz5wPNn+xjaXE+RKt6USGApWpW8wPb7zD2C0gtQR7UKa9/GC\r\nSVyry8h/Y2r/Ly14pVc8UINoFVHlxsWfUm1cHfNK2ic3LaWRZQv0+IuFwiiE\r\nkJd5E/N6tcJ2CQ7wD+VhN73FzKxhpAZTlNUEt9mExkUL5cbu9UdUjpdi1vPL\r\nHd7dDazq1dqFzG7bWBVLKI6u/ntzzBNXD9E=\r\n=05XL\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"skerit","email":"jelle@kipdola.be"},"directories":{},"maintainers":[{"name":"skerit","email":"jelle@kipdola.be"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/process-monitor_0.3.1_1665399748184_0.16814535658938623"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-10T11:02:28.071Z","0.3.1":"2022-10-10T11:02:28.369Z","modified":"2022-10-10T11:02:28.631Z"},"maintainers":[{"name":"skerit","email":"jelle@kipdola.be"}],"description":"Monitors the CPU and memory usage for a PID or collection of PIDs.","homepage":"https://github.com/skerit/process-monitor","keywords":["process","monitor","pid","ps"],"repository":{"type":"git","url":"git://github.com/skerit/process-monitor.git"},"contributors":[{"name":"Brandon Cannaday","email":"brandon@modulus.io"},{"name":"Matt Hernandez","email":"matt@eventargs.com"},{"name":"Jelle De Loecker","email":"jelle@elevenways.be"}],"author":{"name":"Modulus","email":"support@modulus.io"},"bugs":{"url":"https://github.com/skerit/process-monitor/issues"},"readme":"# process-monitor\n\nMonitors the CPU and memory usage for a PID or collection of PIDs asynchronously and emits an event with a stats object which includes information about the specified PID. Allows a user-specified format string for creating a friendly status message.\n\n## Getting Started\n\nInstall the module:\n\n    npm install @11ways/process-monitor\n\nUse it in your script:\n\n    var procmon = require('@11ways/process-monitor');\n\nMonitor a single PID or multiple PIDs:\n\n    // Single PID\n    var single = procmon.monitor({ pid: 1, interval: 5000 }).start();\n\n    // Multiple PIDs\n    var multi = procmon.monitor({ pid: [1, 2, 3] }).start();\n\nHandle the `stats` response - an event will be emitted for each of the specified PIDs and includes the PID:\n\n    single.on('stats', function(stats) {\n      console.dir(stats); // Outputs: { pid: 1, cpu: '0.0', mem: '2248', out: '' }\n    })\n\n_Note: if a PID is not found, the resulting cpu and mem properties will be 0.0 and 0 respectively._\n\n## Documentation\nGenerated code documentation is available [here](http://eventargs.com/docs/process-monitor/) and in the docs directory. This documentation is generated using\n`docco-husky` - to regenerate the documentation, run `$ docco-husky lib/*`.\n\nCurrently the `monitor` function accepts the following configuration options:\n\n### pid\n\nThe `pid` option may be a single process ID or an array from process IDs to monitor. The PID is also included in the `stats` object on when the `stats` event is emitted.\n\n    procmon.monitor({ pid: 1}).start();\n    procmon.monitor({ pid: [1, 2, 3] }).start();\n\n### interval\n\nThe rate in milliseconds at which the processes are checked and the stats event is emitted. The rate defaults to 1000 miliseconds.\n\n    procmon.monitor({ pid: 1, interval: 5000 }).start();\n\n### format\n\nSpecify a format string that will be updated in the `stats` object on update. Use `{pid}`, `{cpu}`, and `{mem}` to output a friendly message on update.\n\n    procmon.monitor({\n      pid: [1, 2],\n      interval: 5000,\n      format: 'PID {pid} - {cpu}% CPU - {mem} memory'\n    }).start();\n\n    procmon.on('stats', function(stats) {\n      console.log(stats.out);\n    });\n\n### technique\nThere are two supported techniques for reading process information.\n\n    procmon.monitor({\n      pid: 1,\n      interval: 5000,\n      technique: 'ps'\n    }).start();\n\n* `ps` (default): Uses the `ps` command to find CPU and memory usage. CPU value returned from the `ps` command is a lifetime average and does not reflect the current usage.\n* `proc`: Uses information stored in the /proc files to calculate current CPU usage. Implementation comes from the [node-usage](https://npmjs.org/package/usage) module. Only supported on Linux.\n\n## Release History\n* 2021/10/25 - v0.3.1 - Replace `usage` with `pidusage`, which doesn't require C-bindings\n* 2013/04/23 - v0.3.0 - Added support for current CPU usage. Uses [node-usage](https://npmjs.org/package/usage) module.\n* 2012/09/28 - v0.2.0 - Added `format` to the configuration object which accepts a format for the output (the `out` property of the `stats` object). Uses [stringformat](https://npmjs.org/package/stringformat) which allows the use of `{cpu}`, `{mem}`, and `{pid}` in the format string.\n* 2012/09/24 - v0.1.1 - Documentation update for publishing to npm.\n* 2012/09/14 - v0.1.0 - Initial release.\n\n## License\nCopyright (c) 2012 Modulus\nLicensed under the MIT license.\n","readmeFilename":"README.md"}