Skip to content

Commit ef345f9

Browse files
J5lxbakins
authored andcommitted
Add support for fcgi via unix sockets (#23)
1 parent 9a63716 commit ef345f9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

collector.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,21 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) {
7272

7373
func getDataFastcgi(u *url.URL) ([]byte, error) {
7474
path := u.Path
75-
if path == "" {
75+
host := u.Host
76+
77+
if path == "" || u.Scheme == "unix" {
7678
path = "/status"
7779
}
80+
if u.Scheme == "unix" {
81+
host = u.Path
82+
}
7883

7984
env := map[string]string{
8085
"SCRIPT_FILENAME": path,
8186
"SCRIPT_NAME": path,
8287
}
8388

84-
fcgi, err := fcgiclient.Dial(u.Scheme, u.Host)
89+
fcgi, err := fcgiclient.Dial(u.Scheme, host)
8590
if err != nil {
8691
return nil, errors.Wrap(err, "fastcgi dial failed")
8792
}

0 commit comments

Comments
 (0)