Permalink
Browse files

Now supports javascript scripts, uptime.js as example

  • Loading branch information...
coredump committed Feb 13, 2012
1 parent c8c375c commit 4343ac857a9dc7509b8b9221a451cbd59982cf0c
Showing with 19 additions and 20 deletions.
  1. +0 −9 config.json
  2. +0 −10 scripts/uptime.coffee
  3. +18 −0 scripts/uptime.js
  4. +1 −1 src/server.coffee
View
@@ -1,9 +0,0 @@
{
"carbonHost": "localhost",
"carbonPort": 2003,
"scriptPath": "/home/coredump/dev/hoardd/scripts",
"fqdn": "janie.coredump.io",
"sampleInterval": 10,
"sendEach": 6,
"maxFailedSens": 10000
}
View
@@ -1,10 +0,0 @@
Os = require 'os'
module.exports = (server) ->
run = () ->
metricPrefix = "#{server.fqdn}.uptime"
server.cli.debug "Running uptime script"
# Node os object makes this easy
uptime = Os.uptime()
server.push_metric metricPrefix, uptime
View
@@ -0,0 +1,18 @@
var Os;
Os = require('os');
module.exports = function(server) {
var run;
run = function() {
var metricPrefix, uptime;
metricPrefix = server.fqdn + ".uptime";
server.cli.debug("Running uptime script");
// Node os object makes this easy
uptime = Os.uptime();
server.push_metric(metricPrefix, uptime);
}
return run;
}
View
@@ -20,7 +20,7 @@ class HoardD extends EventEmitter
load_scripts: ->
for file in Fs.readdirSync @sPath
ext = Path.extname file
continue unless ext == '.coffee'
continue unless ext in [ '.coffee', '.js' ]
toLoad = Path.join(@sPath, Path.basename file)
try
@cli.info "Loading script #{toLoad}"

0 comments on commit 4343ac8

Please sign in to comment.