Guest User

Untitled

a guest
Jul 23rd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Get capacity metrics from df
  2. `df -PT`.split("\n").drop(1).each do |line|
  3. begin
  4. timestamp = Time.now.to_i
  5. fs, _type, _blocks, used, avail, capacity, mnt = line.split
  6. ===========
  7. metrics = {
  8. "#{mnt}.used" => used,
  9. "#{mnt}.avail" => avail,
  10. "#{mnt}.capacity" => capacity
  11. }
  12. iterate over metric key value
  13. send_data_to_sensu key, value, timestamp
  14. ========= vs
  15. =========
  16. ['used','avail','capacity'].each {|item|
  17. send_data_to_sensu item, '#{item}', timestamp
  18. =========
  19. end
  20. end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment