A few cosmetic changes in session handling
This commit is contained in:
@@ -20,18 +20,15 @@ var (
|
||||
|
||||
// StartAgentXRoutine initializes the AgentX client and registers the interface MIB
|
||||
func StartAgentXRoutine(interfaceMIB *ifmib.InterfaceMIB) error {
|
||||
var network, address string
|
||||
// Determine network type based on address format
|
||||
network := "tcp"
|
||||
if strings.HasPrefix(*AgentXAddr, "/") {
|
||||
network = "unix"
|
||||
address = *AgentXAddr
|
||||
} else {
|
||||
network = "tcp"
|
||||
address = *AgentXAddr
|
||||
}
|
||||
|
||||
logger.Debugf("Connecting to AgentX at %s://%s", network, address)
|
||||
logger.Debugf("Connecting to AgentX at %s://%s", network, *AgentXAddr)
|
||||
|
||||
client, err := agentx.Dial(network, address,
|
||||
client, err := agentx.Dial(network, *AgentXAddr,
|
||||
agentx.WithTimeout(1*time.Minute),
|
||||
agentx.WithReconnectInterval(1*time.Second),
|
||||
)
|
||||
@@ -44,6 +41,6 @@ func StartAgentXRoutine(interfaceMIB *ifmib.InterfaceMIB) error {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Printf("Successfully registered with AgentX at %s://%s", network, address)
|
||||
logger.Printf("Successfully registered with AgentX at %s://%s", network, *AgentXAddr)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user