$ bundle install
$ bundle exec ruby main.rb 80.1
Last active
December 18, 2020 11:05
-
-
Save ore-public/58fa8da768a9d2db23b565e2f635fd27 to your computer and use it in GitHub Desktop.
体重をMackerelのサービスメトリクスに送るスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem 'mackerel-client' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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