зеркало из https://github.com/microsoft/statsd.git
Add health status functionality
This commit is contained in:
Родитель
045b1deee4
Коммит
8dadf9f232
|
@ -11,6 +11,7 @@ available:
|
|||
* counters - a dump of all the current counters
|
||||
* gauges - a dump of all the current gauges
|
||||
* timers - a dump of the current timers
|
||||
* health - a way to set the health status of statsd
|
||||
|
||||
The stats output currently will give you:
|
||||
|
||||
|
@ -44,4 +45,8 @@ A simple nagios check can be found in the utils/ directory that can be used to
|
|||
check metric thresholds, for example the number of seconds since the last
|
||||
successful flush to graphite.
|
||||
|
||||
The health output:
|
||||
* the health command alone allows you to see the current health status.
|
||||
* using health up or health down, you can change the current health status.
|
||||
* the healthStatus configuration option allows you to set the default health status at start.
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ Optional Variables:
|
|||
mgmt_address: address to run the management TCP interface on
|
||||
[default: 0.0.0.0]
|
||||
mgmt_port: port to run the management TCP interface on [default: 8126]
|
||||
healthStatus: default health status to be returned and statsd process starts ['up' or 'down', default: 'up']
|
||||
dumpMessages: log all incoming messages
|
||||
flushInterval: interval (in ms) to flush to Graphite
|
||||
percentThreshold: for time information, calculate the Nth percentile(s)
|
||||
|
|
15
stats.js
15
stats.js
|
@ -234,6 +234,7 @@ config.configFile(process.argv[2], function (config, oldConfig) {
|
|||
});
|
||||
|
||||
mgmtServer = net.createServer(function(stream) {
|
||||
var healthStatus = config.healthStatus || 'up';
|
||||
stream.setEncoding('ascii');
|
||||
|
||||
stream.on('error', function(err) {
|
||||
|
@ -246,7 +247,19 @@ config.configFile(process.argv[2], function (config, oldConfig) {
|
|||
|
||||
switch(cmd) {
|
||||
case "help":
|
||||
stream.write("Commands: stats, counters, timers, gauges, delcounters, deltimers, delgauges, quit\n\n");
|
||||
stream.write("Commands: stats, counters, timers, gauges, delcounters, deltimers, delgauges, health, quit\n\n");
|
||||
break;
|
||||
|
||||
case "health":
|
||||
if (cmdline.length > 0) {
|
||||
var cmdaction = cmdline[0].toLowerCase();
|
||||
if (cmdaction === 'up') {
|
||||
healthStatus = 'up';
|
||||
} else if (cmdaction === 'down') {
|
||||
healthStatus = 'down';
|
||||
}
|
||||
}
|
||||
stream.write("health: " + healthStatus + "\n");
|
||||
break;
|
||||
|
||||
case "stats":
|
||||
|
|
Загрузка…
Ссылка в новой задаче