Set correct host name in metrics
This commit fixes a bug where hostnames were not correct in metrics collected by Snap and Hindsight. It relies on Kubernetes' downward API and the spec.nodeName field [1]. The latter is only supported by Kubernetes 1.4 and higher, and the deployment of stacklight-collector pods will fail if Kubernetes 1.3 or lower is used. [1] <https://github.com/kubernetes/kubernetes/pull/27880> Change-Id: I73cd35803a2201a09144bf925753156e47489cff Depends-On: I293bb3aa113883c02f2e738f9d74291bf2f23d95 Partial-Bug: #1614484
This commit is contained in:
parent
2d5bb26ebe
commit
78b13b7209
|
@ -105,10 +105,7 @@ end
|
||||||
-- if the message is invalid
|
-- if the message is invalid
|
||||||
local function create_line()
|
local function create_line()
|
||||||
|
|
||||||
-- FIXME(elemoine) get hostname from Field[Hostname]
|
local tags = {}
|
||||||
local tags = {
|
|
||||||
hostname = escape_string(read_message('Hostname'))
|
|
||||||
}
|
|
||||||
local dimensions, dimensions_index = read_field('dimensions')
|
local dimensions, dimensions_index = read_field('dimensions')
|
||||||
if dimensions then
|
if dimensions then
|
||||||
local i = 0
|
local i = 0
|
||||||
|
|
|
@ -6,8 +6,7 @@ analysis_lua_cpath = "/usr/lib/x86_64-linux-gnu/luasandbox/modules/?.so"
|
||||||
io_lua_path = analysis_lua_path .. ";/usr/lib/x86_64-linux-gnu/luasandbox/io_modules/?.lua"
|
io_lua_path = analysis_lua_path .. ";/usr/lib/x86_64-linux-gnu/luasandbox/io_modules/?.lua"
|
||||||
io_lua_cpath = analysis_lua_cpath .. ";/usr/lib/x86_64-linux-gnu/luasandbox/io_modules/?.so"
|
io_lua_cpath = analysis_lua_cpath .. ";/usr/lib/x86_64-linux-gnu/luasandbox/io_modules/?.so"
|
||||||
|
|
||||||
-- FIXME(elemoine) set "hostname"
|
hostname = "{{ CCP_HINDSIGHT_NODE_NAME }}"
|
||||||
-- hostname =
|
|
||||||
|
|
||||||
input_defaults = {
|
input_defaults = {
|
||||||
-- output_limit = 64 * 1024
|
-- output_limit = 64 * 1024
|
|
@ -12,6 +12,11 @@
|
||||||
"proc_path": "/host-proc"
|
"proc_path": "/host-proc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tags": {
|
||||||
|
"/intel/procfs": {
|
||||||
|
"hostname": "{{ CCP_SNAP_NODE_NAME }}"
|
||||||
|
}
|
||||||
|
},
|
||||||
"metrics": {
|
"metrics": {
|
||||||
"/intel/procfs/cpu/all/idle_percentage": {},
|
"/intel/procfs/cpu/all/idle_percentage": {},
|
||||||
"/intel/procfs/cpu/all/iowait_percentage": {},
|
"/intel/procfs/cpu/all/iowait_percentage": {},
|
||||||
|
|
|
@ -40,10 +40,15 @@ service:
|
||||||
type: host
|
type: host
|
||||||
path: /proc
|
path: /proc
|
||||||
mount-path: /host-proc
|
mount-path: /host-proc
|
||||||
|
env:
|
||||||
|
- name: CCP_SNAP_NODE_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
files:
|
files:
|
||||||
hindsight.cfg:
|
hindsight.cfg:
|
||||||
path: /etc/hindsight/hindsight.cfg
|
path: /etc/hindsight/hindsight.cfg
|
||||||
content: hindsight.cfg
|
content: hindsight.cfg.j2
|
||||||
perm: "0600"
|
perm: "0600"
|
||||||
heka-tcp.cfg:
|
heka-tcp.cfg:
|
||||||
path: /var/lib/hindsight/run/input/heka_tcp.cfg
|
path: /var/lib/hindsight/run/input/heka_tcp.cfg
|
||||||
|
|
Loading…
Reference in New Issue