Troubleshooting

mperham edited this page Mar 13, 2012 · 1 revision
Clone this wiki locally

Seeing No Data in Graphite?

If you are seeing no data appear in Graphite, check a few things:

  1. Does your server firewall allow access to the proper Graphite collector port (port 2003 here)?
  2. Have you added an :on_error handler to see network errors?
reporter = Metriks::Reporter::Graphite.new 'dashboard.acmeco.com', 2003, :on_error => proc { |ex| Airbrake.notify(ex) }
reporter.start
  1. Are you using a forking process, like Passenger, Unicorn, resque or delayed_job? If so, you need to start the reporter in an after_fork block, since all parent threads are stopped in the child when first forked.

delayed_job:

  class Delayed::Worker
    class << self
      alias_method :metriks_after_fork, :after_fork
      def after_fork
        metriks_after_fork
        reporter = Metriks::Reporter::Graphite.new 'dashboard.acmeco.com', 2003, :on_error => proc { |ex| Airbrake.notify(ex) }
        reporter.start
      end
    end
  end

passenger:

  if defined?(PhusionPassenger)
    PhusionPassenger.on_event(:starting_worker_process) do |forked|
      if forked
        reporter = Metriks::Reporter::Graphite.new 'dashboard.acmeco.com', 2003, :on_error => proc { |ex| Airbrake.notify(ex) }
        reporter.start
      end
    end
  end