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 pools ignore in exclude option #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Flags:
be set to a value shorter than your scrape timeout duration. The current
collection run will continue and update the cache when complete (default: 8s)
--pool=POOL ... Name of the pool(s) to collect, repeat for multiple pools (default: all pools).
--exclude=EXCLUDE ... Exclude datasets/snapshots/volumes that match the provided regex (e.g.
--exclude=EXCLUDE ... Exclude pools/datasets/snapshots/volumes that match the provided regex (e.g.
'^rpool/docker/'), may be specified multiple times.
--log.level=info Only log messages with the given severity or above. One of: [debug, info, warn,
error]
Expand Down
12 changes: 11 additions & 1 deletion collector/zfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,17 @@ func (c *ZFS) Collect(ch chan<- prometheus.Metric) {
c.ready <- struct{}{}
}()

pools, poolErr := c.getPools(c.Pools)
pools0, poolErr := c.getPools(c.Pools)

var pools []string

for _, p := range pools0 {
if c.excludes.MatchString(p) {
continue
}

pools = append(pools, p)
}

for name, state := range c.Collectors {
if !*state.Enabled {
Expand Down
Loading