aggiunto controllo della porta per xymon server
This commit is contained in:
parent
a0753ca9ea
commit
c3c7b3b4c1
2 changed files with 12 additions and 3 deletions
2
main.go
2
main.go
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
_VERSION = "v2.4.0"
|
||||
_VERSION = "v2.4.1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
13
xymon.go
13
xymon.go
|
@ -28,13 +28,22 @@ func sendStatus() {
|
|||
}
|
||||
|
||||
func xymonSend(msg []byte) error {
|
||||
cl, err := net.Dial("tcp", opts.Xymon)
|
||||
defer cl.Close()
|
||||
|
||||
var server string
|
||||
|
||||
if strings.Contains(opts.Xymon, ":") {
|
||||
server = opts.Xymon
|
||||
} else {
|
||||
server = opts.Xymon + ":1984"
|
||||
}
|
||||
|
||||
cl, err := net.Dial("tcp", server)
|
||||
if err != nil {
|
||||
fmt.Printf("xymon connect error: ", err)
|
||||
log.Printf("xymon connect error: ", err)
|
||||
return err
|
||||
}
|
||||
defer cl.Close()
|
||||
|
||||
// fmt.Printf("xymon: %s - localhost: %s\n", cl.RemoteAddr(), cl.LocalAddr())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue