Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exec = require('child_process').exec
- {Plugin} = require '../plugin'
- module.exports = class Plugin_Disk_Space extends Plugin
- collect: ->
- df = exec 'df -P -l', (err, stdout, stderr) =>
- [head, mounts...] = stdout.split "\n"
- for line in mounts
- continue if not line
- [fs, total, used, avail, junk, mount] = line.match(/[^\s]+/g)
- fs = fs.replace(/[^a-z0-9\-_]/ig, '_')
- mount = mount.replace(/[^a-z0-9\-_]/ig, '_')
- @submit(
- ['gauge', 'device.' + fs + '.total', total],
- ['gauge', 'device.' + fs + '.used', used],
- ['gauge', 'mount.' + mount + '.total', total],
- ['gauge', 'mount.' + mount + '.used', used],
- )
Add Comment
Please, Sign In to add comment