aggiunto controllo della porta per xymon server

This commit is contained in:
Miki 2015-12-21 11:13:02 +01:00
parent a0753ca9ea
commit c3c7b3b4c1
2 changed files with 12 additions and 3 deletions

View file

@ -11,7 +11,7 @@ import (
)
const (
_VERSION = "v2.4.0"
_VERSION = "v2.4.1"
)
var (

View file

@ -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())