Addes agent address and client address to the client and agent info.
This commit is contained in:
parent
17f5e10547
commit
28b95ff5db
@ -70,6 +70,7 @@ var (
|
|||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
"agent_guid",
|
"agent_guid",
|
||||||
|
"agent_address",
|
||||||
"agent_id",
|
"agent_id",
|
||||||
"agent_username",
|
"agent_username",
|
||||||
"agent_hostname",
|
"agent_hostname",
|
||||||
@ -85,6 +86,7 @@ var (
|
|||||||
Help: "A flexible gauge with dynamic labels, always set to 1",
|
Help: "A flexible gauge with dynamic labels, always set to 1",
|
||||||
},
|
},
|
||||||
[]string{"client_guid",
|
[]string{"client_guid",
|
||||||
|
"client_address",
|
||||||
"client_id",
|
"client_id",
|
||||||
"agent_id",
|
"agent_id",
|
||||||
"agent_guid",
|
"agent_guid",
|
||||||
@ -101,6 +103,7 @@ var (
|
|||||||
func agentLabels(agent models.Agent) prometheus.Labels {
|
func agentLabels(agent models.Agent) prometheus.Labels {
|
||||||
return prometheus.Labels{
|
return prometheus.Labels{
|
||||||
"agent_guid": agent.Guid,
|
"agent_guid": agent.Guid,
|
||||||
|
"agent_address": agent.RemoteAddr,
|
||||||
"agent_id": agent.PublicId,
|
"agent_id": agent.PublicId,
|
||||||
"agent_username": agent.EnvironmentInfo.Username,
|
"agent_username": agent.EnvironmentInfo.Username,
|
||||||
"agent_hostname": agent.EnvironmentInfo.Hostname,
|
"agent_hostname": agent.EnvironmentInfo.Hostname,
|
||||||
@ -113,6 +116,7 @@ func agentLabels(agent models.Agent) prometheus.Labels {
|
|||||||
func clientLabels(client models.Client) prometheus.Labels {
|
func clientLabels(client models.Client) prometheus.Labels {
|
||||||
return prometheus.Labels{
|
return prometheus.Labels{
|
||||||
"client_guid": client.Guid,
|
"client_guid": client.Guid,
|
||||||
|
"client_address": client.RemoteAddr,
|
||||||
"client_id": client.ClientId,
|
"client_id": client.ClientId,
|
||||||
"agent_id": client.PublicId,
|
"agent_id": client.PublicId,
|
||||||
"agent_guid": client.AgentGuid,
|
"agent_guid": client.AgentGuid,
|
||||||
|
@ -82,6 +82,7 @@ func main() {
|
|||||||
state := models.State{}
|
state := models.State{}
|
||||||
agent := models.Agent{
|
agent := models.Agent{
|
||||||
Guid: strconv.Itoa(rand.Int()),
|
Guid: strconv.Itoa(rand.Int()),
|
||||||
|
RemoteAddr: "10.220.1.3:3333",
|
||||||
PublicId: "id",
|
PublicId: "id",
|
||||||
StartTime: time.Now().In(japan),
|
StartTime: time.Now().In(japan),
|
||||||
EnvironmentInfo: comms.EnvironmentInfo{
|
EnvironmentInfo: comms.EnvironmentInfo{
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
const MESSAGE_TIMEOUT = 10 * time.Second
|
const MESSAGE_TIMEOUT = 10 * time.Second
|
||||||
|
|
||||||
type CommChannel struct {
|
type CommChannel struct {
|
||||||
// a separet connection outside of the ssh session
|
// a separate connection outside of the ssh session
|
||||||
SideChannel GOBChannel
|
SideChannel GOBChannel
|
||||||
Session *yamux.Session
|
Session *yamux.Session
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,12 @@ import (
|
|||||||
|
|
||||||
type Agent struct {
|
type Agent struct {
|
||||||
Guid string
|
Guid string
|
||||||
|
RemoteAddr string
|
||||||
PublicId string
|
PublicId string
|
||||||
StartTime time.Time
|
StartTime time.Time
|
||||||
|
|
||||||
|
// TODO add remote address.
|
||||||
|
|
||||||
EnvironmentInfo comms.EnvironmentInfo
|
EnvironmentInfo comms.EnvironmentInfo
|
||||||
ExpiryTime time.Time
|
ExpiryTime time.Time
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ func newAgent(commChannel comms.CommChannel, publicId string, agentInfo comms.En
|
|||||||
return &agentConnection{
|
return &agentConnection{
|
||||||
Agent: models.Agent{
|
Agent: models.Agent{
|
||||||
Guid: strconv.Itoa(rand.Int()),
|
Guid: strconv.Itoa(rand.Int()),
|
||||||
|
RemoteAddr: commChannel.Session.RemoteAddr().String(),
|
||||||
PublicId: publicId,
|
PublicId: publicId,
|
||||||
StartTime: time.Now(),
|
StartTime: time.Now(),
|
||||||
EnvironmentInfo: agentInfo,
|
EnvironmentInfo: agentInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user