Skip to content

Instantly share code, notes, and snippets.

@ore-public
Last active December 18, 2020 11:05
Show Gist options
  • Save ore-public/58fa8da768a9d2db23b565e2f635fd27 to your computer and use it in GitHub Desktop.
Save ore-public/58fa8da768a9d2db23b565e2f635fd27 to your computer and use it in GitHub Desktop.
体重をMackerelのサービスメトリクスに送るスクリプト

使い方

$ bundle install
$ bundle exec ruby main.rb 80.1
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'mackerel-client'
require 'mackerel/client'
mackerel = Mackerel::Client.new(:mackerel_api_key => "<MACKEREL API KEY>")
mackerel.post_service_metrics("hogehoge", [{
name: "body.weight",
time: Time.now.to_i,
value: ARGV[0].to_f
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment