Sha256: c96f67459bf619ea7efd3b3658da2b9f5664dea9af5990f55062cd648911b9f9
Contents?: true
Size: 1.92 KB
Versions: 3
Compression:
Stored size: 1.92 KB
Contents
# # Author: Seth Vargo <sethvargo@gmail.com> # # Copyright 2014 Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require 'statsd' module Falcore class Dumper::Statsd < Dumper::Base validate do presence!('Statsd host') { config.statsd.host } presence!('Statsd port') { config.statsd.port } end run do stat(master) master.slaves.each(&method(:stat)) end private def statsd @statsd ||= Statsd.new(config.statsd.host, config.statsd.port) end # # @private # # Push stats to statsd for this particular +node+. # # @param [Node::Base] node # the node to examine # def stat(node) # Up/down statsd.gauge("#{node.id}.offline", node.offline? ? 1 : 0) # Idle statsd.gauge("#{node.id}.idle", node.idle? ? 1 : 0) # Response time statsd.timing("#{node.id}.response_time", node.response_time) # Temporary space statsd.gauge("#{node.id}.temporary_space", node.temporary_space) # Disk space statsd.gauge("#{node.id}.disk_space", node.disk_space) # Free memory statsd.gauge("#{node.id}.free_memory", node.free_memory) # Total memory statsd.gauge("#{node.id}.total_memory", node.total_memory) # Free swap statsd.gauge("#{node.id}.free_swap", node.free_swap) # Total swap statsd.gauge("#{node.id}.total_swap", node.total_swap) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
falcore-0.2.0 | lib/falcore/dumpers/statsd.rb |
falcore-0.1.1 | lib/falcore/dumpers/statsd.rb |
falcore-0.1.0 | lib/falcore/dumpers/statsd.rb |