Last active
March 22, 2021 12:28
-
-
Save nna774/c81f42f1721a590e45e0e5591c42f484 to your computer and use it in GitHub Desktop.
dns.querytime.rb
This file contains 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
if ENV['MACKEREL_AGENT_PLUGIN_META'] == '1' | |
require 'json' | |
meta = { | |
:graphs => { | |
'dns.querytime' => { | |
:label => 'time', | |
:unit => 'integer', | |
:metrics => [ | |
{ | |
:name => 'kasuga', | |
:label => 'kasuga' | |
}, { | |
:name => 'tsugu', | |
:label => 'tsugu' | |
} | |
] | |
} | |
} | |
} | |
puts '# mackerel-agent-plugin' | |
puts meta.to_json | |
exit 0 | |
end | |
def q(to) | |
name = 'dynamodb.ap-northeast-1.amazonaws.com' | |
`dig "@#{to}" "#{name}" | grep "Query time" | cut -d ' ' -f4`.chomp | |
end | |
puts [ 'dns.querytime.tsugu', q('10.8.192.42'), Time.now.to_i ].join("\t") | |
puts [ 'dns.querytime.kasuga', q('10.8.208.42'), Time.now.to_i ].join("\t") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment