Created
November 25, 2016 15:51
-
-
Save smfreegard/2ef7b5ce86e3f9d3c640518aee5de5eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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