Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 05376347 authored by Simon Delamare's avatar Simon Delamare
Browse files

[lib] Update kwollect generator to support labels

parent e4142b9c
Branches
No related tags found
No related merge requests found
......@@ -14,10 +14,12 @@ neteq.fetch('metrics', []).each {|metric|
port_name = lport['snmp_name']
# TODO: Handle secondary interface
port_node = lport['uid']
labels = lport['kind'] == 'node' ? {'interface': lport['port']} : {}
labels.update({'_device_alias': port_node})
-%>
- name: <%= metric['name'] %>
device_id: <%= neteq_uid %>-port-<%= port_uid %>
device_alias: <%= port_node %>
labels: <%= labels.to_json %>
url: snmp://<%= neteq.fetch('snmp_community', 'public')%>@<%= neteq_uid %>.<%= site_uid %>.grid5000.fr/<%= metric['source']['id'].sub('%SNMP_IFACE%', "{{ #{port_name} }}") %>
update_every: <%= metric['period'] > 0 ? metric['period'] : metric['optional_period'] %>
<%- if metric['period'] == 0 -%>
......
......@@ -22,7 +22,7 @@ cluster.fetch('metrics', []).each {|metric|
- name: <%= metric['name'] %>
device_id: <%= node_uid %>
url: <%= metric['source']['protocol'] %>://<%= auth %><%= node_uid %>-bmc.<%= site_uid %>.grid5000.fr/<%= metric['source']['id'] %>
device_alias: <%= node_uid %>-bmc
labels: <%= metric.fetch('labels', {}).update({'_device_alias': node_uid+'-bmc'}).to_json %>
update_every: <%= metric['period'] > 0 ? metric['period'] : metric['optional_period'] %>
<%- if metric['period'] == 0 -%>
optional: true
......
......@@ -14,7 +14,7 @@ pdu.fetch('metrics', []).each {|metric|
- name: <%= metric['name'] %>
device_id: <%= pdu_uid %>-port-<%= port_uid %>
<%- if single_port -%>
device_alias: <%= node_uid %>
labels: <%= {'_device_alias': node_uid}.to_json %>
<%- end -%>
url: snmp://<%= pdu.fetch('snmp_community', 'public')%>@<%= pdu_uid %>.<%= site_uid %>.grid5000.fr/<%= metric['source']['id'].sub('%PORT%', "#{port_uid}") %>
update_every: <%= metric['period'] > 0 ? metric['period'] : metric['optional_period'] %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment