Class: Nagios
- Inherits:
-
Object
- Object
- Nagios
- Includes:
- Graphs::AreaStackedChart, Mongoid::Attributes::Dynamic, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/app/models/nagios.rb
Class Method Summary collapse
Class Method Details
.chart_data(options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/app/models/nagios.rb', line 9 def self.chart_data( = {}) charts = [] charts << self.nagios_chart() return charts end |
.graphs ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/app/models/nagios.rb', line 26 def self.graphs { :services_critical => { :line_color => "#FF0000", :hidden => false, :title => "Services with critical errors" }, :services_warning => { :line_color => "#FFFF00", :hidden => false, :title => "Services with warnings" }, :services_unknown => { :line_color => "#FFaa00", :hidden => false, :title => "Services in unknown state" }, :services_ok => { :line_color => "#00FF00", :hidden => true, :title => "Services with no problems" } } end |
.nagios_chart(options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/app/models/nagios.rb', line 15 def self.nagios_chart() chart = self.chart_structure({:title => "Nagios alerts statistic", :value_axis => { :title => "Number of services"}}) #TODO - get fields from above DRY chart[:graph_data] = Nagios.where(:timestamp.gte => [:start]). where(:timestamp.lt => [:end]). where(:host_id => [:host_id]). where(:plugin_id => [:plugin_id]). order_by(:timestamp) return chart end |