Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
pm2-process-manager
Advanced tools
Readme
Manage pm2 process(es) with style and ease. Cache the pm2 process(es) Datas and access them at any time to get almost live stats!
Why to use it?
Planned Features:
npm install pm2-process-manager
If you have on your System pm2 as a process manager, and wanna show stats or manage the processes via the pm2 api, on a modern and efficient, cached way. Then use this package!
restart
, stop
, delete
processesimport { Pm2Manager } from "./pm2CacheManager/lib/index.js"
const pm2 = new Pm2Manager({ updateCacheInterval: 5000 });
After a couple moments, it's already cached (less than 500ms) Every updateCacheInterval-ms it's updating the Cache!
const data1 = pm2.cache.get("processName");
const data2 = pm2.cache.get(11) // or with process Id
Example output when getting the cache data, if it's available
{
pm2Id: 11,
pm2Name: "Project Great",
status: "online",
processId: 1472,
memoryUsage: {
pm2Raw: 90128384,
megaBytes: 85.95,
formatted: "85.95 MB",
},
cpuUsage: {
percent: 0.7,
formatted: "70%"
},
execPath: "/usr/bin/node",
cwd: "/home/project/great",
logOutputPath: "/root/.pm2/logs/Project-Great-out.log",
logErrorsPath: "/root/.pm2/logs/Project-Great-error.log",
execMode: "fork", // 'fork' | 'cluster'
uptime: {
pm2Raw: 1682751244258,
startTimestamp: 1682751244258,
startDate: 2023-04-29T06:54:04.258Z,
upSinceSec: 8847.245
},
pm2Env: { },
}
pm2.restart(11); // via pm2 id
pm2.delete("name") // via pm2 name
pm2.stop("Other Name") // via a different Name
import { ... } from "pm2-process-manager"
)Name | Type | Usage | Description |
---|---|---|---|
Pm2Manager | Main Class - Pm2 Process Manager | const pm2 = new Pm2Manager({ updateCacheInterval :number }) | Pm2 Process Manager, to cache pm2 system data and much more |
formatPM2Data | Function - Utility | formatPM2Data(Partial<pm2Api.ProcessDescription>) | Format pm2Api.list() process-data |
formatBytes | Function - Utility | formatBytes(bytes: number, decimals: number = ", noString: boolean = false) | Format Bytes to KB, MB, GB (with or without string) |
existFile | Async Function - Utility | await existFile(path: string) | Check if a Path actually exists |
Pm2Manager
Class:const pm2 = new Pm2Manager({ updateCacheInterval: 5000 });
Name | Type | Usage | Description |
---|---|---|---|
cache | Property = Map<pm2Id, pm2Data>() | pm2.cache.get(pm2Id) | The Cached Pm2 Process Data |
cachePm2Data | Function | pm2.cachePm2Data() | Caches the Pm2 Data of the System into pm2.cache Note: If Pm2Manager#updateCacheInterval > 5000, it does this automatically every N milliseconds |
findId | Function | pm2.findId(process: string | name) | Return the Pm2 ID (from the cache), of a given Process-name / process-Id |
restart | Async Function | await pm2.restart(process: string | name) | Restart a Pm2 Process, by providing a Process-Name / Process-ID |
stop | Async Function | await pm2.stop(process: string | name) | Stop a pm2 Process, by providing a Process-Name / Process-ID P |
FAQs
Manage pm2 process(es) with style and ease. Cache the pm2 process(es) Datas and access them at any time to get almost live stats!
The npm package pm2-process-manager receives a total of 4 weekly downloads. As such, pm2-process-manager popularity was classified as not popular.
We found that pm2-process-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.