Added client environment info to the prometheus metrics as labels.
This commit is contained in:
parent
346996e761
commit
7f6fa31c8a
@ -45,7 +45,15 @@ var (
|
||||
Name: "agent_info",
|
||||
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(
|
||||
prometheus.GaugeOpts{
|
||||
@ -53,7 +61,16 @@ var (
|
||||
Name: "client_info",
|
||||
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,
|
||||
"agentid": client.PublicId,
|
||||
"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