Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
silvareal committed Nov 5, 2022
2 parents 3d5724e + cbb49ae commit 57f5ab2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions client/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ func (hosts *HostsController) sendMetric(host config.Host, client *Client) {
},
Error: false,
}
client.Send <- message
if config.Contains(hosts.ReadOnlyHosts, host) {
client.Send <- message
}
} else {
// check for error 127 which means command was not found
var errorContent string
Expand All @@ -112,7 +114,10 @@ func (hosts *HostsController) sendMetric(host config.Host, client *Client) {
func (hosts *HostsController) Poll(client *Client) {
for {
for _, host := range hosts.Info.Hosts {
if config.Contains(hosts.ReadOnlyHosts, host) && hosts.clientConnected() {
if !hosts.clientConnected() {
return
}
if config.Contains(hosts.ReadOnlyHosts, host) {
go hosts.sendMetric(host, client)
}
}
Expand Down
2 changes: 1 addition & 1 deletion inspector/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (i *TcpLinux) Parse(output string) {
portString := address[len(address)-1]
port, err := strconv.Atoi(portString)
if err != nil {
log.Fatal("Could not parse port number in TcpLinux")
log.Fatalf("Could not parse port number in TcpLinux %s", err.Error())
}
ports[port] = status
}
Expand Down

0 comments on commit 57f5ab2

Please sign in to comment.