Add port tag to nginx plugin
This commit is contained in:
parent
87ed2d4a21
commit
6e76759225
|
@ -142,14 +142,20 @@ func (n *Nginx) gatherUrl(addr *url.URL, acc plugins.Accumulator) error {
|
||||||
// Get tag(s) for the nginx plugin
|
// Get tag(s) for the nginx plugin
|
||||||
func getTags(addr *url.URL) map[string]string {
|
func getTags(addr *url.URL) map[string]string {
|
||||||
h := addr.Host
|
h := addr.Host
|
||||||
var htag string
|
host, port, err := net.SplitHostPort(h)
|
||||||
if host, _, err := net.SplitHostPort(h); err == nil {
|
if err != nil {
|
||||||
htag = host
|
host = addr.Host
|
||||||
|
if addr.Scheme == "http" {
|
||||||
|
port = "80"
|
||||||
|
} else if addr.Scheme == "https" {
|
||||||
|
port = "443"
|
||||||
} else {
|
} else {
|
||||||
htag = h
|
port = ""
|
||||||
}
|
}
|
||||||
return map[string]string{"server": htag}
|
|
||||||
}
|
}
|
||||||
|
return map[string]string{"server": host, "port": port}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugins.Add("nginx", func() plugins.Plugin {
|
plugins.Add("nginx", func() plugins.Plugin {
|
||||||
|
|
Loading…
Reference in New Issue