There's two options:

- You can set the --collector.filesystem.ignored-mount-points (default
"^/(dev|proc|sys|var/lib/docker/.+)($|/)") on the specific hosts to not
even export metrics about that mountpoint, if you never need those metrics
at all.

- If that's not an option, you could have static recording rules that
create time series with the instance+job labels that you would want to
exclude, like:

groups:
- name: excludes
  rules:
  - record: excluded_instance_mountpoints
    expr: 1
    labels:
       instance: <my-excluded-instance-name1>
       mountpoint: <my-excluded-mountpoint-name1>
  - record: excluded_instance_mountpoints
    expr: 1
    labels:
       instance: <my-excluded-instance-name2>
       mountpoint: <my-excluded-mountpoint-name2>

...and then you could use those recorded time series to remove alerts for
those exceptions:

      predict_linear(node_filesystem_free_bytes{fstype!~"tmpfs"}[1h], 4 *
3600) < 0
  unless on(instance, mountpoint)
      excluded_instance_mountpoints

(you could change "instance" to "job" in the example if indeed your
exceptions are grouped by "job" in your case)

On Fri, May 15, 2020 at 11:30 AM Ishvar B <[email protected]> wrote:

> Hi,
>
> I need help for the below issue.
>
> I have the below query regarding which as per the query definition is
> working fine. But for certain host (say example*), I want to exclude
> /var/cache/fscache metric from alert rule. I am little confused as either
> it excludes the metric for all the hosts or collects it for all the hosts.
>
> query: predict_linear(node_filesystem_free_bytes{fstype!~"tmpfs"}[1h], 4 *
> 3600) < 0 -  This collects all metrics for all the hosts
>
> updated query:
> predict_linear(node_filesystem_free_bytes{fstype!~"tmpfs",job!~"example.*",mountpoint!~"/var/cache/fscache"}[1h],
> 4 * 3600) < 0 - This excludes both the host example* and the mountpoint
> /var/cache/fscache. I want this to alert for all the metrics for all the
> hosts but for example* host don't alert for mounpoint /var/cache/fscache.
>
> Any help is highly appreciated.
>
> Thanks
> Eswar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/253f05a4-5428-4b00-af77-0ca93f2c93c8%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/253f05a4-5428-4b00-af77-0ca93f2c93c8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Julius Volz
PromLabs - promlabs.com

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAObpH5z52F5N-A-Z9RjdZpOwQHaW_TvP9vt6PV3%2BwVP%3D%3DuS4vA%40mail.gmail.com.

Reply via email to