Registry / observability / pmx
library1.6.8jsnpmunverified

PMX is the programmatic integration library for PM2 and Keymetrics.io (v1.6.8, latest stable). It enables Node.js applications to expose custom metrics (simple values, counters, meters, histograms), triggerable remote functions, exception alerts, custom events, and network traffic monitoring to the PM2 CLI and Keymetrics dashboard. Released irregularly with minor version bumps, it supports Node.js >= 0.10. Key differentiators: deep PM2/Keymetrics integration, low-overhead metric probes, and production monitoring without external monitoring services.

npm install pmx
INSTALL
IMPORT
SIG · PMX
P
pmx
observabilityjavascriptv1.6.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pmx
import pmx from 'pmx'
const pmx = require('pmx')
Default ESM import; CJS require works in Node but may conflict with type module.
probe
import pmx from 'pmx'; const probe = pmx.probe()
const probe = require('pmx').probe()
probe() is a method on the default export, not a named export.
Metric (type)
import type { Metric } from 'pmx'
TypeScript users should use `import type` for type-only imports; pmx ships its own types.

Initializes PMX, creates a metric tracking user count and a counter for HTTP requests.

import pmx from 'pmx'; import http from 'http'; const probe = pmx.probe(); const users = {}; const metric = probe.metric({ name: 'Realtime user', value: () => Object.keys(users).length }); const counter = probe.counter({ name: 'req/sec' }); http.createServer((req, res) => { counter.inc(); res.end('ok'); }).listen(3000); console.log('Server running on port 3000');
pmx --version
Debug
Known issues
breakingpmx@1.0 removed the old 'pmx.init()' API; use 'pmx.init()' is now imported as default.
fix
Use default import `import pmx from 'pmx'` and call `pmx.init()` with options if needed.
affects: >=1.0.0
gotchaThe 'probe' object is obtained via `pmx.probe()` – it is not a direct export.
fix
Always call `const probe = pmx.probe()` before using metric, counter, meter, or histogram.
affects: >=1.0.0
deprecatedThe 'event' method (pmx.event()) is deprecated; use custom events via Keymetrics API or pm2.io.
fix
Avoid using pmx.event(); instead emit custom events using pm2.connect or pm2.io packages.
affects: >=1.5.0
gotchaMeter samples default to 1 (per second); to get per-minute rate set samples to 60.
fix
Set `samples: 60` in meter options if you need per-minute averaging.
affects: >=1.0.0
gotchaHistogram measurement must be one of 'mean', 'median', 'p75', etc.; invalid values silently produce no data.
fix
Use only valid measurement strings: 'mean', 'median', 'p75', 'p95', 'p99', 'p999'.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'pmx'
PMX not installed or not in node_modules.
fix
Run `npm install pmx --save` to add it to dependencies.
pmx.probe is not a function
Used named import instead of default import: `import { probe } from 'pmx'`.
fix
Use default import: `import pmx from 'pmx'` then `pmx.probe()`.
TypeError: pmx.metric is not a function
Calling `pmx.metric()` directly instead of via probe.
fix
First create probe: `const probe = pmx.probe()` then use `probe.metric()`.
Upgrade
Version history
1.6.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
2
Resources
pmx — npm install pmx · libregistry