Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Good news)))

ceilometer/publisher/gnocchi.py:

    def sample_attributes(self, sample):
    attrs = {}
    sample_dict = sample.as_dict()

    for name, definition in self._attributes.items():
        value = definition.parse(sample_dict)
        if value is not None:
            attrs[name] = value
    return attrs

sample.as_dict() -

{
'user_id': u'923...0f2',
'name': u'network.incoming.delta',
'resource_id': u'instance-00000027-a00...03b-tapb330714d-fb',
'timestamp': u'2019-05-27T09: 00: 57.684200',
'resource_metadata': {
    u'instance_host': u'os-host1',
    u'image': {
        u'id': u'e2b8...c47'
    },
    u'ephemeral_gb': 0,
    u'flavor': {
        u'name': u'basic1.xs',
        u'ram': 1024,
        u'ephemeral': 0,
        u'vcpus': 1,
        u'swap': 0,
        u'disk': 20,
        u'id': u'643...d2a'
    },
    u'memory_mb': 1024,
    u'display_name': u'deleteme4',
    u'parameters': {

    },
    u'state': u'running',
    u'status': u'active',
    u'disk_gb': 20,
    u'fref': None,
    u'mac': u'fa... 39',
    u'task_state': u'',
    u'image_ref_url': None,
    u'root_gb': 20,
    u'name': u'tapb330714d-fb',
    u'host': u'b86...332',
    u'vnic_name': u'tapb330714d-fb',
    u'instance_id': u'a0091...03b',
    u'instance_type': u'basic1.xs',
    u'vcpus': 1,
    u'image_ref': u'e2b...c47',
    u'architecture': u'x86_64',
    u'os_type': u'hvm'
},
'volume': 0,
'source': 'openstack',
'unit': u'B',
'project_id': u'107...0bf',
'type': 'delta',
'id': 'f38...621',
'monotonic_time': None

}

So I just set instance_host instead of region_id:

  - resource_type: instance_network_interface
...
attributes:
  name: resource_metadata.vnic_name
  instance_id: resource_metadata.instance_id
  instance_host: resource_metadata.instance_host

Not exactly what I want but it's better than nothing :)