Module: RRDNotifier::BindataParser
- Defined in:
- lib/rrd-grapher/notifier/parsers/bindata_parser.rb
Defined Under Namespace
Classes: Packet, Part, Reader, ValuePart, ValuePartData
Constant Summary collapse
- HOST =
part type
0x0000
- TIME =
0x0001
- PLUGIN =
0x0002
- PLUGIN_INSTANCE =
0x0003
- TYPE =
0x0004
- TYPE_INSTANCE =
0x0005
- VALUES =
0x0006
- INTERVAL =
0x0007
- MESSAGE =
0x0100
- SEVERITY =
0x0101
- PART_TYPE_AS_STRING =
{ 'host' => HOST, 'time' => TIME, 'plugin' => PLUGIN, 'plugin_instance' => PLUGIN_INSTANCE, 'type' => TYPE, 'type_instance' => TYPE_INSTANCE, 'values' => VALUES, 'interval' => INTERVAL, 'message' => MESSAGE, 'severity' => SEVERITY }.freeze
- COMPRESSED_FIELDS =
[ :host, :time, :interval ].freeze
Class Method Summary collapse
Class Method Details
.parse(data) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/rrd-grapher/notifier/parsers/bindata_parser.rb', line 120 def self.parse(data) ret = [] reader = Reader.new packets = reader.read(data).packets last_packet = {} if packets.size >= 1 packets.each_with_index do |packet, i| p = RRDNotifier::Packet.new(last_packet) p.merge_data_from(packet) last_packet = p if p.data? ret << p end end ret end |