Class: RRDNotifier::Packet

Inherits:
DataStruct show all
Defined in:
lib/rrd-grapher/notifier/structures.rb

Overview

from collectd source code plugin.h

notification: int severity; cdtime_t time; char message; char host; char plugin; char plugin_instance; char type; char type_instance;

data value_t *values; int values_len; cdtime_t time; cdtime_t interval; char host; char plugin; char plugin_instance; char type; char type_instance;

Instance Method Summary collapse

Methods inherited from DataStruct

attributes, #initialize, #merge_data_from, properties, #selected_field?

Constructor Details

This class inherits a constructor from DataStruct

Instance Method Details

#data?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/rrd-grapher/notifier/structures.rb', line 49

def data?
  self.message.nil?
end

#measure_idObject

return a unique id for the measured data.



75
76
77
# File 'lib/rrd-grapher/notifier/structures.rb', line 75

def measure_id
  "#{host}-#{plugin_display}-#{type_display}"
end

#notification?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/rrd-grapher/notifier/structures.rb', line 45

def notification?
  !self.message.nil?
end

#plugin_displayObject



57
58
59
60
61
62
63
# File 'lib/rrd-grapher/notifier/structures.rb', line 57

def plugin_display
  if plugin_instance && !plugin_instance.empty?
    "#{plugin}/#{plugin_instance}"
  else
    plugin
  end
end

#type_displayObject



65
66
67
68
69
70
71
# File 'lib/rrd-grapher/notifier/structures.rb', line 65

def type_display
  if type_instance &&  !type_instance.empty?
    "#{type}/#{type_instance}"
  else
    type
  end
end

#value(index = 0) ⇒ Object



53
54
55
# File 'lib/rrd-grapher/notifier/structures.rb', line 53

def value(index = 0)
  values[index]
end