include base modules include alinex-modules |
async = require 'alinex-async'
Exec = require 'alinex-exec'
{string} = require 'alinex-util'
|
exports.description = 'General testing of server'
exports.options =
server:
alias: 's'
type: 'string'
describe: 'server to check'
|
|
exports.handler = (args, cb) ->
|
|
shortcuts to predefined objects |
debug = exports.debug
report = exports.report
|
get server data |
debug "get data from remote server..."
console.log args.server
async.mapOf
df:
remote: args.server
cmd: 'df'
args: [
'-t', 'ext4'
'-t', 'vfat'
]
priority: 'immediately'
conntrack:
remote: args.server
cmd: 'grep'
args: [ 'conntrack', '/var/log/syslog' ]
priority: 'immediately'
, (setup, name, cb) ->
Exec.run setup, (err, proc) -> cb null, proc
, (err, data) ->
return cb err if err
|
make report |
checkDf data.df, report
|
done processing |
cb()
checkDf = (proc, report) ->
report.h2 "Disk Usage"
if proc.result.error
report.alert proc.result.error
if proc.stdout()
data = string.toList proc.stdout(), /\n/, /\s+/
report.table data[1..], data[0]
exports.email =
base: 'default'
|