-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from mfreeman451/updates/snmp_poller
fixed issues with json configs
- Loading branch information
Showing
18 changed files
with
518 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package agent | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
"net" | ||
"time" | ||
) | ||
|
||
// SNMPChecker implements the checker.Checker interface. | ||
type SNMPChecker struct { | ||
address string | ||
} | ||
|
||
func (c *SNMPChecker) Check(ctx context.Context) (bool, string) { | ||
// Try to connect to the SNMP service | ||
conn, err := net.DialTimeout("tcp", c.address, 5*time.Second) | ||
if err != nil { | ||
return false, fmt.Sprintf("Failed to connect to SNMP service: %v", err) | ||
} | ||
defer func(conn net.Conn) { | ||
err := conn.Close() | ||
if err != nil { | ||
log.Printf("Failed to close connection: %v", err) | ||
} | ||
}(conn) | ||
|
||
return true, fmt.Sprintf("SNMP service is running at %s", c.address) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.