Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add port tag to apache plugin #220

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions plugins/apache/apache.go
Expand Up @@ -134,13 +134,11 @@ 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
if host, port, err := net.SplitHostPort(h); err == nil {
return map[string]string{"server": host, "port": port}
} else {
htag = h
return map[string]string{"server": h, "port": "80"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if this just defaulted to having the "server" tag only, since this could be 443 in the case of https

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that, or check for https at the beginning of the string and use port 443 if it's there

}
return map[string]string{"server": htag}
}

func init() {
Expand Down