work of 1 min load and set server as up

This commit is contained in:
Henry Oswald 2016-04-08 15:18:22 +01:00
parent 260987336d
commit 2864d776f5

View file

@ -131,11 +131,11 @@ os = require('os')
server = net.createServer (socket) ->
fiveMinLoad = os.loadavg()[1]
fiveMinLoad = os.loadavg()[0]
availableWorkingCpus = os.cpus().length - 1
freeLoad = availableWorkingCpus - fiveMinLoad
freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100)
socket.write "#{freeLoadPercentage}%\n", "ASCII"
socket.write "up, #{freeLoadPercentage}%\n", "ASCII"
socket.pipe socket
return