[prometheus-users] Re: snmp_exporter drop metrics by metric value or label value

2024-04-03 Thread Dmitry Abramov
Have you been able to figure out the problem? I have the same problem and 
would really like to find a solution. Thank you in advance!

On Wednesday, October 26, 2022 at 5:36:47 AM UTC+3 Wang Yngwie wrote:

> I have tried, but it didn't work, thank you all the same, maybe I should 
> read the source code deeply.
>
> 在2022年10月18日星期二 UTC+8 17:22:37 写道:
>
>> Did it work? Which approach did you use?
>>
>> On Tuesday, 18 October 2022 at 07:48:06 UTC+1 yngwi...@gmail.com wrote:
>>
>>> Thanks  Brain, for your help.
>>>
>>> 在2022年10月17日星期一 UTC+8 16:45:17 写道:
>>>
 > Hi, everyone. I want to drop some specific metrics by its value or 
 its label value. For example:
 > 1. the temperature metrics which values are 65535 meaning it's invalid
 > 2. the power metrics which "entPhysicalClass" label vale are not "6" 
 and "9"

 Metric relabeling 
 
  
 can be used to drop specific timeseries in the scrape response by label 
 value, but not by metric value.

 The only way I can think of dropping by metric value (without changing 
 the exporter output) is to use a recording rule 
 
  to 
 make a modified version of the timeseries, e.g.

 expr: some_temperature != 65535

 If you are happy to hack snmp.yml, you could try something like this 
 (untested):

 regex_extracts:
   "":
   - value: NaN
 regex: ^65535$
   - value: $1
 regex: ^(.+)$

 I don't know if it's allowed to use "NaN" as a value here: source code 
 
  
 suggests it should work . However, 
 a time series consisting of NaNs 
  is not the 
 same as an empty/missing timeseries. So depending on your requirements, it 
 may be better to do

 regex_extracts:
   "":
   - value: INVALID
 regex: ^65535$
   - value: $1
 regex: ^(.+)$

 although this will cause snmp_exporter to generate noisy logs at debug 
 level.

 Aside: if you look through the examples you can see regex being used to 
 divide a value by 10 (or by 100), e.g.:

 regex_extracts:
   "":
   - value: $1.$2
 regex: ^(?:(.*)(.))$

 > I write the snmp.yml without generator, didn't find a specification 
 of its syntax, does somebody know where it is?


 https://github.com/prometheus/snmp_exporter/blob/v0.20.0/generator/FORMAT.md

 Having said that, you may just want to run the generator and look at 
 its output to see what it emits :-)

 On Monday, 17 October 2022 at 08:01:08 UTC+1 yngwi...@gmail.com wrote:

> Hi, everyone. I want to drop some specific metrics by its value or its 
> label value. For example:
> 1. the temperature metrics which values are 65535 meaning it's invalid
> 2. the power metrics which "entPhysicalClass" label vale are not "6" 
> and "9"
>
> I write the snmp.yml without generator, didn't find a specification of 
> its syntax, does somebody know where it is?
>
> Appreciate for any help :)
>


-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/a22d0e01-1dce-4e02-b4a2-0af90ca86263n%40googlegroups.com.


[prometheus-users] Re: snmp_exporter drop metrics by metric value or label value

2022-10-25 Thread Wang Yngwie
I have tried, but it didn't work, thank you all the same, maybe I should 
read the source code deeply.

在2022年10月18日星期二 UTC+8 17:22:37 写道:

> Did it work? Which approach did you use?
>
> On Tuesday, 18 October 2022 at 07:48:06 UTC+1 yngwi...@gmail.com wrote:
>
>> Thanks  Brain, for your help.
>>
>> 在2022年10月17日星期一 UTC+8 16:45:17 写道:
>>
>>> > Hi, everyone. I want to drop some specific metrics by its value or its 
>>> label value. For example:
>>> > 1. the temperature metrics which values are 65535 meaning it's invalid
>>> > 2. the power metrics which "entPhysicalClass" label vale are not "6" 
>>> and "9"
>>>
>>> Metric relabeling 
>>> 
>>>  
>>> can be used to drop specific timeseries in the scrape response by label 
>>> value, but not by metric value.
>>>
>>> The only way I can think of dropping by metric value (without changing 
>>> the exporter output) is to use a recording rule 
>>> 
>>>  to 
>>> make a modified version of the timeseries, e.g.
>>>
>>> expr: some_temperature != 65535
>>>
>>> If you are happy to hack snmp.yml, you could try something like this 
>>> (untested):
>>>
>>> regex_extracts:
>>>   "":
>>>   - value: NaN
>>> regex: ^65535$
>>>   - value: $1
>>> regex: ^(.+)$
>>>
>>> I don't know if it's allowed to use "NaN" as a value here: source code 
>>> 
>>>  
>>> suggests it should work . However, a 
>>> time 
>>> series consisting of NaNs 
>>>  is not the 
>>> same as an empty/missing timeseries. So depending on your requirements, it 
>>> may be better to do
>>>
>>> regex_extracts:
>>>   "":
>>>   - value: INVALID
>>> regex: ^65535$
>>>   - value: $1
>>> regex: ^(.+)$
>>>
>>> although this will cause snmp_exporter to generate noisy logs at debug 
>>> level.
>>>
>>> Aside: if you look through the examples you can see regex being used to 
>>> divide a value by 10 (or by 100), e.g.:
>>>
>>> regex_extracts:
>>>   "":
>>>   - value: $1.$2
>>> regex: ^(?:(.*)(.))$
>>>
>>> > I write the snmp.yml without generator, didn't find a specification of 
>>> its syntax, does somebody know where it is?
>>>
>>>
>>> https://github.com/prometheus/snmp_exporter/blob/v0.20.0/generator/FORMAT.md
>>>
>>> Having said that, you may just want to run the generator and look at its 
>>> output to see what it emits :-)
>>>
>>> On Monday, 17 October 2022 at 08:01:08 UTC+1 yngwi...@gmail.com wrote:
>>>
 Hi, everyone. I want to drop some specific metrics by its value or its 
 label value. For example:
 1. the temperature metrics which values are 65535 meaning it's invalid
 2. the power metrics which "entPhysicalClass" label vale are not "6" 
 and "9"

 I write the snmp.yml without generator, didn't find a specification of 
 its syntax, does somebody know where it is?

 Appreciate for any help :)

>>>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/3010874a-f821-45c5-857d-4ed1a6591b2en%40googlegroups.com.


[prometheus-users] Re: snmp_exporter drop metrics by metric value or label value

2022-10-18 Thread Brian Candler
Did it work? Which approach did you use?

On Tuesday, 18 October 2022 at 07:48:06 UTC+1 yngwi...@gmail.com wrote:

> Thanks  Brain, for your help.
>
> 在2022年10月17日星期一 UTC+8 16:45:17 写道:
>
>> > Hi, everyone. I want to drop some specific metrics by its value or its 
>> label value. For example:
>> > 1. the temperature metrics which values are 65535 meaning it's invalid
>> > 2. the power metrics which "entPhysicalClass" label vale are not "6" 
>> and "9"
>>
>> Metric relabeling 
>> 
>>  
>> can be used to drop specific timeseries in the scrape response by label 
>> value, but not by metric value.
>>
>> The only way I can think of dropping by metric value (without changing 
>> the exporter output) is to use a recording rule 
>> 
>>  to 
>> make a modified version of the timeseries, e.g.
>>
>> expr: some_temperature != 65535
>>
>> If you are happy to hack snmp.yml, you could try something like this 
>> (untested):
>>
>> regex_extracts:
>>   "":
>>   - value: NaN
>> regex: ^65535$
>>   - value: $1
>> regex: ^(.+)$
>>
>> I don't know if it's allowed to use "NaN" as a value here: source code 
>>  
>> suggests it should work . However, a time 
>> series consisting of NaNs 
>>  is not the same 
>> as an empty/missing timeseries. So depending on your requirements, it may 
>> be better to do
>>
>> regex_extracts:
>>   "":
>>   - value: INVALID
>> regex: ^65535$
>>   - value: $1
>> regex: ^(.+)$
>>
>> although this will cause snmp_exporter to generate noisy logs at debug 
>> level.
>>
>> Aside: if you look through the examples you can see regex being used to 
>> divide a value by 10 (or by 100), e.g.:
>>
>> regex_extracts:
>>   "":
>>   - value: $1.$2
>> regex: ^(?:(.*)(.))$
>>
>> > I write the snmp.yml without generator, didn't find a specification of 
>> its syntax, does somebody know where it is?
>>
>>
>> https://github.com/prometheus/snmp_exporter/blob/v0.20.0/generator/FORMAT.md
>>
>> Having said that, you may just want to run the generator and look at its 
>> output to see what it emits :-)
>>
>> On Monday, 17 October 2022 at 08:01:08 UTC+1 yngwi...@gmail.com wrote:
>>
>>> Hi, everyone. I want to drop some specific metrics by its value or its 
>>> label value. For example:
>>> 1. the temperature metrics which values are 65535 meaning it's invalid
>>> 2. the power metrics which "entPhysicalClass" label vale are not "6" and 
>>> "9"
>>>
>>> I write the snmp.yml without generator, didn't find a specification of 
>>> its syntax, does somebody know where it is?
>>>
>>> Appreciate for any help :)
>>>
>>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/9229d5d7-0873-4378-b81a-e007dd397daen%40googlegroups.com.


[prometheus-users] Re: snmp_exporter drop metrics by metric value or label value

2022-10-17 Thread Wang Yngwie
Thanks  Brain, for your help.

在2022年10月17日星期一 UTC+8 16:45:17 写道:

> > Hi, everyone. I want to drop some specific metrics by its value or its 
> label value. For example:
> > 1. the temperature metrics which values are 65535 meaning it's invalid
> > 2. the power metrics which "entPhysicalClass" label vale are not "6" and 
> "9"
>
> Metric relabeling 
> 
>  
> can be used to drop specific timeseries in the scrape response by label 
> value, but not by metric value.
>
> The only way I can think of dropping by metric value (without changing the 
> exporter output) is to use a recording rule 
>  
> to 
> make a modified version of the timeseries, e.g.
>
> expr: some_temperature != 65535
>
> If you are happy to hack snmp.yml, you could try something like this 
> (untested):
>
> regex_extracts:
>   "":
>   - value: NaN
> regex: ^65535$
>   - value: $1
> regex: ^(.+)$
>
> I don't know if it's allowed to use "NaN" as a value here: source code 
>  
> suggests it should work . However, a time 
> series consisting of NaNs 
>  is not the same 
> as an empty/missing timeseries. So depending on your requirements, it may 
> be better to do
>
> regex_extracts:
>   "":
>   - value: INVALID
> regex: ^65535$
>   - value: $1
> regex: ^(.+)$
>
> although this will cause snmp_exporter to generate noisy logs at debug 
> level.
>
> Aside: if you look through the examples you can see regex being used to 
> divide a value by 10 (or by 100), e.g.:
>
> regex_extracts:
>   "":
>   - value: $1.$2
> regex: ^(?:(.*)(.))$
>
> > I write the snmp.yml without generator, didn't find a specification of 
> its syntax, does somebody know where it is?
>
>
> https://github.com/prometheus/snmp_exporter/blob/v0.20.0/generator/FORMAT.md
>
> Having said that, you may just want to run the generator and look at its 
> output to see what it emits :-)
>
> On Monday, 17 October 2022 at 08:01:08 UTC+1 yngwi...@gmail.com wrote:
>
>> Hi, everyone. I want to drop some specific metrics by its value or its 
>> label value. For example:
>> 1. the temperature metrics which values are 65535 meaning it's invalid
>> 2. the power metrics which "entPhysicalClass" label vale are not "6" and 
>> "9"
>>
>> I write the snmp.yml without generator, didn't find a specification of 
>> its syntax, does somebody know where it is?
>>
>> Appreciate for any help :)
>>
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/fd33b3a5-65f3-48db-9ed1-8e002189a974n%40googlegroups.com.


[prometheus-users] Re: snmp_exporter drop metrics by metric value or label value

2022-10-17 Thread Brian Candler
> Hi, everyone. I want to drop some specific metrics by its value or its 
label value. For example:
> 1. the temperature metrics which values are 65535 meaning it's invalid
> 2. the power metrics which "entPhysicalClass" label vale are not "6" and 
"9"

Metric relabeling 

 
can be used to drop specific timeseries in the scrape response by label 
value, but not by metric value.

The only way I can think of dropping by metric value (without changing the 
exporter output) is to use a recording rule 
 
to 
make a modified version of the timeseries, e.g.

expr: some_temperature != 65535

If you are happy to hack snmp.yml, you could try something like this 
(untested):

regex_extracts:
  "":
  - value: NaN
regex: ^65535$
  - value: $1
regex: ^(.+)$

I don't know if it's allowed to use "NaN" as a value here: source code 
 
suggests it should work . However, a time 
series consisting of NaNs 
 is not the same as 
an empty/missing timeseries. So depending on your requirements, it may be 
better to do

regex_extracts:
  "":
  - value: INVALID
regex: ^65535$
  - value: $1
regex: ^(.+)$

although this will cause snmp_exporter to generate noisy logs at debug 
level.

Aside: if you look through the examples you can see regex being used to 
divide a value by 10 (or by 100), e.g.:

regex_extracts:
  "":
  - value: $1.$2
regex: ^(?:(.*)(.))$

> I write the snmp.yml without generator, didn't find a specification of 
its syntax, does somebody know where it is?

https://github.com/prometheus/snmp_exporter/blob/v0.20.0/generator/FORMAT.md

Having said that, you may just want to run the generator and look at its 
output to see what it emits :-)

On Monday, 17 October 2022 at 08:01:08 UTC+1 yngwi...@gmail.com wrote:

> Hi, everyone. I want to drop some specific metrics by its value or its 
> label value. For example:
> 1. the temperature metrics which values are 65535 meaning it's invalid
> 2. the power metrics which "entPhysicalClass" label vale are not "6" and 
> "9"
>
> I write the snmp.yml without generator, didn't find a specification of its 
> syntax, does somebody know where it is?
>
> Appreciate for any help :)
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/0a4a3423-487e-423b-8ab4-02096a49ace9n%40googlegroups.com.