Last active
August 29, 2015 14:11
-
-
Save darron/dd99233e767b02b0bbd5 to your computer and use it in GitHub Desktop.
Import Memory usage of Apache processes into Datadog
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
require 'rubygems' | |
require 'statsd' | |
statsd = Statsd.new | |
while true do | |
ps = `ps -C apache2 -o rss --no-header` | |
memory = ps.split("\n") | |
memory = memory.collect{|mem| mem.strip} | |
memory.each do |mem| | |
statsd.histogram('apache.rss_memory', mem) | |
end | |
puts "Sleeping for 10 seconds" | |
sleep(10) | |
end |
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
{ | |
"viz": "timeseries", | |
"requests": [ | |
{ | |
"q": "max:apache.rss_memory.max{*}", | |
"style": { | |
"width": "thin", | |
"type": "dashed" | |
} | |
}, | |
{ | |
"q": "max:apache.rss_memory.median{*}", | |
"style": { | |
"width": "normal" | |
} | |
}, | |
{ | |
"q": "max:apache.rss_memory.95percentile{*}", | |
"style": { | |
"width": "normal", | |
"type": "solid" | |
} | |
} | |
], | |
"events": [], | |
"markers": [ | |
{ | |
"type": "error dashed", | |
"value": "y = 262144", | |
"label": "Current limit - 256MB" | |
}, | |
{ | |
"type": "warning dashed", | |
"value": "y = 196608", | |
"label": "Proposed limit - 192MB" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment