diff --git a/plugins/apache/apache.go b/plugins/apache/apache.go index 307f8490718fe..f4098b3313928 100644 --- a/plugins/apache/apache.go +++ b/plugins/apache/apache.go @@ -134,13 +134,18 @@ func (n *Apache) gatherScores(data string, acc plugins.Accumulator, tags map[str // Get tag(s) for the apache plugin func getTags(addr *url.URL) map[string]string { h := addr.Host - var htag string - if host, _, err := net.SplitHostPort(h); err == nil { - htag = host - } else { - htag = h + host, port, err := net.SplitHostPort(h) + if err != nil { + host = addr.Host + if addr.Scheme == "http" { + port = "80" + } else if addr.Scheme == "https" { + port = "443" + } else { + port = "" + } } - return map[string]string{"server": htag} + return map[string]string{"server": host, "port": port} } func init() {