forked from gilles/redis-munin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresque_workers_
More file actions
executable file
·35 lines (29 loc) · 788 Bytes
/
Copy pathresque_workers_
File metadata and controls
executable file
·35 lines (29 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/env ruby
require 'net/http'
require 'uri'
$0 =~ /resque_stats_(\d+_\d+_\d+_\d+)_(\d+)$/
port = $2
ip = $1.gsub('_', '.')
port = 5678 #unless port
ip = 'localhost' unless ip
if ARGV[0] == "config"
puts "graph_title Resque Workers in use"
puts "graph_category resque"
puts "graph_info This graph shows resque workers in use vs. the total"
puts "graph_args --lower-limit 0 --upper-limit 100"
puts 'graph_vlabel %'
puts 'workers.label workers'
puts 'workers.type GAUGE'
exit 0
end
workers = 1
working = 0
f = Net::HTTP.get URI.parse("http://#{ip}:#{port}/stats.txt")
f.split(' ').each do |l|
if l =~ /resque.workers=(\d+)/
workers = $1.to_i
elsif l =~ /resque.working=(\d+)/
working = $1.to_i
end
end
puts "workers.value #{working/workers}"