Mentions légales du service

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

[lib] Add prometheus support to kwollect generator

parent f24ba08a
No related branches found
No related tags found
No related merge requests found
...@@ -11,18 +11,28 @@ cluster.fetch('metrics', []).each {|metric| ...@@ -11,18 +11,28 @@ cluster.fetch('metrics', []).each {|metric|
next if metric['source']['protocol'] == "pdu" next if metric['source']['protocol'] == "pdu"
if metric['source']['protocol'] == "ipmisensor" if metric['source']['protocol'] == "ipmisensor"
auth = ipmi_credentials+"@" host = ipmi_credentials+"@"+node_uid+"-bmc."+site_uid+".grid5000.fr"
label = {'_device_alias' => node_uid+'-bmc'}
elsif metric['source']['protocol'] == "snmp" elsif metric['source']['protocol'] == "snmp"
auth = "public@" host = "public@"+node_uid+"-bmc."+site_uid+".grid5000.fr"
label = {'_device_alias' => node_uid+'-bmc'}
else else
auth = "" host = node_uid+"."+site_uid+".grid5000.fr"
label = {}
end
if metric['source'].has_key?('port')
host = host+":"+metric['source']['port'].to_s
end
id = metric['source'].fetch('id', '')
if id.kind_of?(Array)
id = id.join("-")
end end
-%> -%>
- name: <%= metric['name'] %> - name: <%= metric['name'] %>
device_id: <%= node_uid %> device_id: <%= node_uid %>
url: <%= metric['source']['protocol'] %>://<%= auth %><%= node_uid %>-bmc.<%= site_uid %>.grid5000.fr/<%= metric['source']['id'] %> url: <%= metric['source']['protocol'] %>://<%= host %>/<%= id %>
labels: <%= metric.fetch('labels', {}).update({'_device_alias' => node_uid+'-bmc'}).to_json %> labels: <%= metric.fetch('labels', {}).update(label).to_json %>
update_every: <%= metric['period'] > 0 ? metric['period'] : metric['optional_period'] %> update_every: <%= metric['period'] > 0 ? metric['period'] : metric['optional_period'] %>
<%- if metric['period'] == 0 -%> <%- if metric['period'] == 0 -%>
optional: true optional: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment