Added client environment info to the prometheus metrics as labels.
This commit is contained in:
parent
2fe2be0b9a
commit
128be0ebb5
@ -45,7 +45,15 @@ var (
|
|||||||
Name: "agent_info",
|
Name: "agent_info",
|
||||||
Help: "A flexible gauge with dynamic labels, always set to 1",
|
Help: "A flexible gauge with dynamic labels, always set to 1",
|
||||||
},
|
},
|
||||||
[]string{"guid", "id", "username", "hostname", "pwd", "os", "shell"}) // Label names
|
[]string{
|
||||||
|
"guid",
|
||||||
|
"id",
|
||||||
|
"username",
|
||||||
|
"hostname",
|
||||||
|
"pwd",
|
||||||
|
"os",
|
||||||
|
"shell",
|
||||||
|
})
|
||||||
|
|
||||||
clientInfo = promauto.NewGaugeVec(
|
clientInfo = promauto.NewGaugeVec(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
@ -53,7 +61,16 @@ var (
|
|||||||
Name: "client_info",
|
Name: "client_info",
|
||||||
Help: "A flexible gauge with dynamic labels, always set to 1",
|
Help: "A flexible gauge with dynamic labels, always set to 1",
|
||||||
},
|
},
|
||||||
[]string{"guid", "id", "agentid", "sessiontype"}, // Label names
|
[]string{"guid",
|
||||||
|
"id",
|
||||||
|
"agentid",
|
||||||
|
"sessiontype",
|
||||||
|
"username",
|
||||||
|
"hostname",
|
||||||
|
"pwd",
|
||||||
|
"os",
|
||||||
|
"shell",
|
||||||
|
}, // Label names
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,6 +92,11 @@ func clientLabels(client models.Client) prometheus.Labels {
|
|||||||
"id": client.ClientId,
|
"id": client.ClientId,
|
||||||
"agentid": client.PublicId,
|
"agentid": client.PublicId,
|
||||||
"sessiontype": client.SessionType,
|
"sessiontype": client.SessionType,
|
||||||
|
"username": client.EnvironmentInfo.Username,
|
||||||
|
"hostname": client.EnvironmentInfo.Hostname,
|
||||||
|
"pwd": client.EnvironmentInfo.Pwd,
|
||||||
|
"os": client.EnvironmentInfo.OS,
|
||||||
|
"shell": client.EnvironmentInfo.Shell,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user