Skip to content

Instantly share code, notes, and snippets.

@smfreegard
Created November 25, 2016 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smfreegard/2ef7b5ce86e3f9d3c640518aee5de5eb to your computer and use it in GitHub Desktop.
Save smfreegard/2ef7b5ce86e3f9d3c640518aee5de5eb to your computer and use it in GitHub Desktop.
var lynx = require('lynx');
var metrics = new lynx('localhost', 8125);
var hostname = require('os').hostname();
// Connections per second
// Connections by source port (25, 80, ...)
exports.hook_lookup_rdns = function (next, conn) {
// Ignore connections from localhost
if (conn.remote_ip === '127.0.0.1' ||
conn.remote_ip === '::1')
{
return next();
}
metrics.increment('haraka.connections,host=' + hostname + ',port=' + conn.local_port);
return next();
}
// Messages per second
exports.hook_queue_ok = function (next, conn) {
// Ignore connections from localhost
if (conn.remote.ip === '127.0.0.1' ||
conn.remote.ip === '::1')
{
return next();
}
metrics.increment('haraka.messages,host=' + hostname);
return next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment