0.0.1 • Published 8 years ago
pm2-graphite v0.0.1
pm2-graphite
PM2 graphite sender module to send aggregated metrics. If you send messages from cluster of PM2, pm2-graphite will aggregate and send them to graphite server.
Usage
Installation
$ pm2 install pm2-graphite
$ pm2 set pm2-graphite:interval 30000 # Default: 10000(ms)
# with configurtaion file
$ pm2 set pm2-graphite:path /absolute/path/of/the/configuration/file
# with pm2 configurtaion
$ pm2 set pm2-graphite:host my.graphite.host.com #target graphite host
$ pm2 set pm2-graphite:port 2003 #target graphite port
Configuration File Format
{
"graphite": {
"host": "my.graphite.host.com",
"port": 2003
}
}
PM2 Application Configuration (app.json
)
For now, PM2-Graphite Only Support cluster mode.
{
"apps": [
{
"name": "app_name",
"...": "...",
"exec_mode": "cluster"
}
]
}
Send message from cluster to pm2-graphite
const metrics = {
'app_name.$id.metricsName': metricsValue // String `$id` will replaced to app id of PM2. (Only first appeared string)
'app_name.$id.requestCounts': 10000 // Example
};
process.send && process.send({ metrics });
Metrics which would be sent to graphite
{
"app_name.1.requestCounts" : 100,
"app_name.1.errorCounts" : 10,
"app_name.2.requestCounts" : 100,
"app_name.2.errorCounts" : 10,
"app_name.3.requestCounts" : 100,
"app_name.3.errorCounts" : 10,
"app_name.4.requestCounts" : 100,
"app_name.4.errorCounts" : 10
}
Monyt
If you use Monyt with its ProcessSender, you could make metrics to send easily.
0.0.1
8 years ago