Permalink
Browse files

added fmp status

  • Loading branch information...
Andre Lewis
Andre Lewis committed Mar 20, 2011
1 parent d061e48 commit a00d034f460031d5918145c2f7983f34c00b7bda
Showing with 20 additions and 0 deletions.
  1. +20 −0 fmp_status/fmp_status.rb
View
@@ -0,0 +1,20 @@
+class FpmStatus < Scout::Plugin
+ needs 'open-uri', 'json'
+
+ OPTIONS=<<-EOS
+ url:
+ name: FPM Status Url
+ default: "http://localhost/status?json"
+ EOS
+
+ def build_report
+ url = option(:url) || 'http://localhost/status?json'
+ open(url) do |p|
+ content = p.read
+ stats = JSON.parse(content)
+ report({:idle_processes => stats["idle processes"].to_i,
+ :active_processes => stats["active processes"].to_i,
+ :total_processes => stats["total processes"].to_i})
+ end
+ end
+end

0 comments on commit a00d034

Please sign in to comment.