Module: MuninPassenger::Graphs
- Defined in:
- lib/munin_passenger/graphs.rb
Class Method Summary collapse
-
.cpu_config ⇒ Object
############# passenger_cpu #############.
- .cpu_values ⇒ Object
- .escape_group(g_name) ⇒ Object
- .get_stats ⇒ Object
-
.last_used_config ⇒ Object
################### passenger_last_used ###################.
- .last_used_values ⇒ Object
-
.processed_config ⇒ Object
################### passenger_processed ###################.
- .processed_values ⇒ Object
-
.queue_config ⇒ Object
############### passenger_queue ###############.
- .queue_values ⇒ Object
-
.ram_config ⇒ Object
############# passenger_ram #############.
- .ram_values ⇒ Object
-
.uptime_config ⇒ Object
################ passenger_uptime ################.
- .uptime_values ⇒ Object
Class Method Details
.cpu_config ⇒ Object
############# passenger_cpu #############
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/munin_passenger/graphs.rb', line 96 def self.cpu_config groups, pses = get_stats ret = '' ret += <<-EOF graph_category passenger graph_title Passenger CPU graph_vlabel % EOF pses.each_with_index do |ps, i| pidstr = ps ? "(PID #{ps.pid})" : "(no PID)" ret += <<-EOF _worker_#{i + 1}_cpu.label Worker #{i + 1} #{pidstr} EOF end ret end |
.cpu_values ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/munin_passenger/graphs.rb', line 113 def self.cpu_values groups, pses = get_stats ret = '' pses.each_with_index do |ps, i| next unless ps ret += <<-EOF _worker_#{i + 1}_cpu.value #{ps.cpu} EOF end ret end |
.escape_group(g_name) ⇒ Object
4 5 6 7 |
# File 'lib/munin_passenger/graphs.rb', line 4 def self.escape_group(g_name) g_name.gsub(/^[^a-zA-Z_]/, '_'). gsub(/[^a-zA-Z0-9_]/, '_') end |
.get_stats ⇒ Object
9 10 11 12 13 14 |
# File 'lib/munin_passenger/graphs.rb', line 9 def self.get_stats doc = MuninPassenger::Collect.parse_stats(MuninPassenger::Collect.run_status) groups = MuninPassenger::Collect.get_group_stats(doc) pses = MuninPassenger::Collect.get_ps_stats(doc) [groups, pses] end |
.last_used_config ⇒ Object
################### passenger_last_used ###################
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/munin_passenger/graphs.rb', line 195 def self.last_used_config groups, pses = get_stats ret = '' ret += <<-EOF graph_category passenger graph_title Last used graph_vlabel Seconds EOF pses.each_with_index do |ps, i| pidstr = ps ? "(PID #{ps.pid})" : "(no PID)" ret += <<-EOF _worker_#{i + 1}_last_used.label Worker #{i + 1} #{pidstr} EOF end ret end |
.last_used_values ⇒ Object
212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/munin_passenger/graphs.rb', line 212 def self.last_used_values groups, pses = get_stats ret = '' pses.each_with_index do |ps, i| next unless ps ret += <<-EOF _worker_#{i + 1}_last_used.value #{ps.last_used} EOF end ret end |
.processed_config ⇒ Object
################### passenger_processed ###################
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/munin_passenger/graphs.rb', line 129 def self.processed_config groups, pses = get_stats ret = '' ret += <<-EOF graph_category passenger graph_title Requests processed graph_vlabel Requests EOF pses.each_with_index do |ps, i| pidstr = ps ? "(PID #{ps.pid})" : "(no PID)" ret += <<-EOF _worker_#{i + 1}_processed.label Worker #{i + 1} #{pidstr} EOF end ret end |
.processed_values ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/munin_passenger/graphs.rb', line 146 def self.processed_values groups, pses = get_stats ret = '' pses.each_with_index do |ps, i| next unless ps ret += <<-EOF _worker_#{i + 1}_processed.value #{ps.processed} EOF end ret end |
.queue_config ⇒ Object
############### passenger_queue ###############
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/munin_passenger/graphs.rb', line 20 def self.queue_config groups, pses = get_stats ret = '' ret += <<-EOF graph_category passenger graph_title Passenger queue graph_vlabel Requests EOF groups.each do |g| ret += <<-EOF _group_#{escape_group(g.name)}_queue.label #{g.name} EOF end pses.each_with_index do |ps, i| pidstr = ps ? "(PID #{ps.pid})" : "(no PID)" ret += <<-EOF _worker_#{i + 1}_sessions.label Worker #{i + 1} #{pidstr} EOF end ret end |
.queue_values ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/munin_passenger/graphs.rb', line 42 def self.queue_values groups, pses = get_stats ret = '' groups.each do |g| ret += <<-EOF _group_#{escape_group(g.name)}_queue.value #{g.queue} EOF end pses.each_with_index do |ps, i| next unless ps ret += <<-EOF _worker_#{i + 1}_sessions.value #{ps.sessions} EOF end ret end |
.ram_config ⇒ Object
############# passenger_ram #############
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/munin_passenger/graphs.rb', line 63 def self.ram_config groups, pses = get_stats ret = '' ret += <<-EOF graph_category passenger graph_title Passenger memory usage graph_vlabel Bytes EOF pses.each_with_index do |ps, i| pidstr = ps ? "(PID #{ps.pid})" : "(no PID)" ret += <<-EOF _worker_#{i + 1}_ram.label Worker #{i + 1} #{pidstr} EOF end ret end |
.ram_values ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/munin_passenger/graphs.rb', line 80 def self.ram_values groups, pses = get_stats ret = '' pses.each_with_index do |ps, i| next unless ps ret += <<-EOF _worker_#{i + 1}_ram.value #{ps.ram * 1024} EOF end ret end |
.uptime_config ⇒ Object
################ passenger_uptime ################
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/munin_passenger/graphs.rb', line 162 def self.uptime_config groups, pses = get_stats ret = '' ret += <<-EOF graph_category passenger graph_title Uptime graph_vlabel Hours EOF pses.each_with_index do |ps, i| pidstr = ps ? "(PID #{ps.pid})" : "(no PID)" ret += <<-EOF _worker_#{i + 1}_uptime.label Worker #{i + 1} #{pidstr} EOF end ret end |
.uptime_values ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/munin_passenger/graphs.rb', line 179 def self.uptime_values groups, pses = get_stats ret = '' pses.each_with_index do |ps, i| next unless ps ret += <<-EOF _worker_#{i + 1}_uptime.value #{ps.uptime.to_f / 60 / 60} EOF end ret end |