[prometheus-users] Re: snmp_exorter got "was collected before with the same name and label values"

2022-12-07 Thread Wang Yngwie
You really helped me, I just don't know that indexes can be a list.
Appreciate you very much.

在2022年12月7日星期三 UTC+8 16:14:39 写道:

> OK, so you're writing snmp.yml by hand, without using generator, and 
> without access to the MIB files.  This makes it harder.
>
> The examples you gave both seem to have two OID parts as their table index:
>
> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6*.289.1* = INTEGER: 1
> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6*.290.1* = INTEGER: 1
> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7*.0.0* = INTEGER: 1
> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7*.0.1* = INTEGER: 1
>
> If we could see the MIB files then we could understand what they represent.
>
> Without the docs and without having such a device to test I can't really 
> help. However you could look at some of the examples in snmp.yml where the 
> table index has two parts and/or is more than one OID component:
>
>   - name: upsAdvBatteryCurrentTableIndex
> oid: 1.3.6.1.4.1.318.1.1.1.2.2.14.1.1
> type: gauge
> help: The Battery Frame identifier - 1.3.6.1.4.1.318.1.1.1.2.2.14.1.1
> indexes:
> - labelname: upsAdvBatteryCurrentTableIndex
>   type: gauge
> - labelname: upsAdvBatteryCurrentIndex
>   type: gauge
>
> or:
>
> indexes:
> - labelname: bsnAPDot3MacAddress
>   type: PhysAddress48
> *  fixed_size: 6*
> - labelname: bsnAPIfSlotId
>   type: gauge
>
> or
>
> indexes:
> - labelname: virtualServerIndex
>   type: gauge
> - labelname: realServerIndex
>   type: gauge
>
> On Wednesday, 7 December 2022 at 03:11:53 UTC yngwi...@gmail.com wrote:
>
>> Thanks @Brain :)
>>
>> Let me describe the problem in more detail.
>> 1. It's a HUAWEI S5335-S48T4X, software,Version 5.170 (S5335 
>> V200R019C10SPC500) 
>> 2. I do not have its MIB but just a OID doc, the OID of hwEntityFanState  
>> is 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7
>> 3. My snmp config is
>> ```
>> switch_huawei_gen:
>>   version: 2
>>   auth:
>> community: foo
>>   retries: 0
>>   timeout: 3m
>>   walk:
>> - 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7 # fanStatus
>>   metrics:
>> - name: devFanStatus
>>   oid: 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7
>>   type: gauge
>>   help: The current state of the device fan.
>>   indexes:
>> - labelname: entIndex
>>   type: OctetString
>>   enum_values:
>> 1: normal
>> 2: abnormal
>> ```
>> 4. snmpwalk result:
>> ```
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.0 = INTEGER: 1
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.1 = INTEGER: 1
>> ```
>> 5. curl -g 'locahost:9116/snmp?target=x.x.x.x&module=foo'
>> ```
>> An error has occurred while serving metrics:
>>
>> 1 error(s) occurred:
>> * collected metric "devFanStatus" { label: 
>> gauge: } was collected before with the same name and label values
>> ```
>>
>> I think the entIndex should be unique in OctetString, but snmp_exporter 
>> doesn't think so.
>> How can I fix it?
>>
>> 在2022年12月6日星期二 UTC+8 22:23:59 写道:
>>
>>> What it says is, you're generating the same metric two or more times 
>>> (with identical set of labels):
>>>
>>> devPowerStatus{entIndex="0x2101"} 1
>>>
>>> If you hit snmp_exporter with curl you should be able to confirm whether 
>>> or not this is the case.
>>>
>>> curl -g 'locahost:9116/snmp?target=x.x.x.x&module=foo'
>>>  
>>> If that's the case, then you need to fix your exporter config.  You 
>>> haven't shown your generator.yml nor described the MIBs you're reading, but 
>>> 2011 is the enterprise ID for Huawei.
>>>
>>> On Tuesday, 6 December 2022 at 13:23:01 UTC yngwi...@gmail.com wrote:
>>>
 Hi everybody, I got a problem that the entIndex "289.1" can not be 
 parsed correctly。
 snmp_exporter html:
 ```
 collected metric "devPowerStatus" { label:>>> value:"0x2101" > gauge: } was collected before with the same 
 name 
 and label values
 ```


 snmpwalk 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6:
 ```
 SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.289.1 = INTEGER: 1
 SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.290.1 = INTEGER: 1
 SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.291.1 = INTEGER: 1
 SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.545.1 = INTEGER: 1
 SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.546.1 = INTEGER: 1
 SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.547.1 = INTEGER: 1
 ```
 snmp_exporter config:
 ```
- name: devPowerStatus
   oid: 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6
   type: gauge
   help: The current state of the device power
   indexes:
 - labelname: entIndex
   type: OctetString
   implied: true
 ```
 Something maybe wrong with the indexes config, could someone help me?

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group a

[prometheus-users] Re: snmp_exorter got "was collected before with the same name and label values"

2022-12-06 Thread Wang Yngwie
Thanks @Brain :)

Let me describe the problem in more detail.
1. It's a HUAWEI S5335-S48T4X, software,Version 5.170 (S5335 
V200R019C10SPC500) 
2. I do not have its MIB but just a OID doc, the OID of hwEntityFanState  
is 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7
3. My snmp config is
```
switch_huawei_gen:
  version: 2
  auth:
community: foo
  retries: 0
  timeout: 3m
  walk:
- 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7 # fanStatus
  metrics:
- name: devFanStatus
  oid: 1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7
  type: gauge
  help: The current state of the device fan.
  indexes:
- labelname: entIndex
  type: OctetString
  enum_values:
1: normal
2: abnormal
```
4. snmpwalk result:
```
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.0 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.10.1.7.0.1 = INTEGER: 1
```
5. curl -g 'locahost:9116/snmp?target=x.x.x.x&module=foo'
```
An error has occurred while serving metrics:

1 error(s) occurred:
* collected metric "devFanStatus" { label: 
gauge: } was collected before with the same name and label values
```

I think the entIndex should be unique in OctetString, but snmp_exporter 
doesn't think so.
How can I fix it?

在2022年12月6日星期二 UTC+8 22:23:59 写道:

> What it says is, you're generating the same metric two or more times (with 
> identical set of labels):
>
> devPowerStatus{entIndex="0x2101"} 1
>
> If you hit snmp_exporter with curl you should be able to confirm whether 
> or not this is the case.
>
> curl -g 'locahost:9116/snmp?target=x.x.x.x&module=foo'
>  
> If that's the case, then you need to fix your exporter config.  You 
> haven't shown your generator.yml nor described the MIBs you're reading, but 
> 2011 is the enterprise ID for Huawei.
>
> On Tuesday, 6 December 2022 at 13:23:01 UTC yngwi...@gmail.com wrote:
>
>> Hi everybody, I got a problem that the entIndex "289.1" can not be parsed 
>> correctly。
>> snmp_exporter html:
>> ```
>> collected metric "devPowerStatus" { label:> > gauge: } was collected before with the same name and label 
>> values
>> ```
>>
>>
>> snmpwalk 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6:
>> ```
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.289.1 = INTEGER: 1
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.290.1 = INTEGER: 1
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.291.1 = INTEGER: 1
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.545.1 = INTEGER: 1
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.546.1 = INTEGER: 1
>> SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.547.1 = INTEGER: 1
>> ```
>> snmp_exporter config:
>> ```
>>- name: devPowerStatus
>>   oid: 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6
>>   type: gauge
>>   help: The current state of the device power
>>   indexes:
>> - labelname: entIndex
>>   type: OctetString
>>   implied: true
>> ```
>> Something maybe wrong with the indexes config, could someone help me?
>>
>

-- 
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/ff358f0d-3c58-4131-94dc-13d36e770f71n%40googlegroups.com.


[prometheus-users] snmp_exorter got "was collected before with the same name and label values"

2022-12-06 Thread Wang Yngwie
Hi everybody, I got a problem that the entIndex "289.1" can not be parsed 
correctly。
snmp_exporter html:
```
collected metric "devPowerStatus" { label: 
gauge: } was collected before with the same name and label values
```


snmpwalk 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6:
```
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.289.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.290.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.291.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.545.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.546.1 = INTEGER: 1
SNMPv2-SMI::enterprises.2011.5.25.31.1.1.18.1.6.547.1 = INTEGER: 1
```
snmp_exporter config:
```
   - name: devPowerStatus
  oid: 1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6
  type: gauge
  help: The current state of the device power
  indexes:
- labelname: entIndex
  type: OctetString
  implied: true
```
Something maybe wrong with the indexes config, could someone help me?

-- 
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/ce33cbd4-d4a0-4b66-bf77-d8251bf2141en%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-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] snmp_exporter drop metrics by value or label value

2022-10-17 Thread Wang Yngwie
Hi everyone. I want to drop some specific metrics by its value or label 
value, for example:

1. the temperature metrics which values are 65535 meaning it's invalid
2. the power metrics which "entPhysicalClass" label value are not "6" and 
"9"

How can I write the configuration? I write the "snmp.yml" without 
generator, where can I find the specification of its syntax?

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/2980ec27-194f-4428-b96d-0543d4fc6647n%40googlegroups.com.


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

2022-10-17 Thread Wang Yngwie
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/e4de8483-e208-4af6-a7d0-1dbe44ddd8a4n%40googlegroups.com.


Re: [prometheus-users] How can I calculate node process usage in percentage?

2021-01-18 Thread Wang Yngwie
Brilliant, thank you very much :)

在2021年1月18日星期一 UTC+8 下午4:43:58 写道:

> By default, a binary operator will try to match series from both sides on 
> *all* of their labels, so only series with identical labelsets will match 
> and make it into the output.
>
> You will need to constrain which labels are used for matching using "on()" 
> or "ignoring()" (include-list vs. exclude-list), and potentially also allow 
> a many-to-one match (assuming your left selector can select multiple 
> processes, whereas the right side is only one series per "ip"). This might 
> work:
>
>   
> namedprocess_namegroup_memory_bytes{job="process",ip="10.1.1.2",memtype="resident"}
> / on(ip) group_left()
>   node_memory_MemTotal_bytes{job="node",ip="10.1.1.2"}
>
> This is assuming that the "ip" label will always be present and match on 
> both sides, like in the two example series you provided. And then to get 
> the same information for multiple hosts + processes you would remove the 
> "ip" in the selector to get all of them:
>
>   namedprocess_namegroup_memory_bytes{job="process",memtype="resident"}
> / on(ip) group_left()
>   node_memory_MemTotal_bytes{job="node"}
> ᐧ
>
> On Mon, Jan 18, 2021 at 9:32 AM Wang Yngwie  wrote:
>
>> Hi, everyone. 
>> I use process-exporter to get some process' memory usage like: 
>> namedprocess_namegroup_memory_bytes{job="process",ip="10.1.1.2",memtype="resident"}.
>>  
>> Also I can get this node's total memory by node-exporter like: 
>> node_memory_MemTotal_bytes{job="node",ip="10.1.1.2"}.
>> But when I divide them I got nothing: 
>> namedprocess_namegroup_memory_bytes{job="process",ip="10.1.1.2",memtype="resident"}
>>  
>> / node_memory_MemTotal_bytes{job="node",ip="10.1.1.2"}.
>> So how can I get the usage in percentage?
>>
>> -- 
>> 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-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/b4fb993b-fccd-4d10-9720-32676d60eb10n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/b4fb993b-fccd-4d10-9720-32676d60eb10n%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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/2e3fa0bc-36e7-4bff-9832-fae15f53n%40googlegroups.com.


[prometheus-users] How can I calculate node process usage in percentage?

2021-01-18 Thread Wang Yngwie
Hi, everyone. 
I use process-exporter to get some process' memory usage like: 
namedprocess_namegroup_memory_bytes{job="process",ip="10.1.1.2",memtype="resident"}.
 
Also I can get this node's total memory by node-exporter like: 
node_memory_MemTotal_bytes{job="node",ip="10.1.1.2"}.
But when I divide them I got nothing: 
namedprocess_namegroup_memory_bytes{job="process",ip="10.1.1.2",memtype="resident"}
 
/ node_memory_MemTotal_bytes{job="node",ip="10.1.1.2"}.
So how can I get the usage in percentage?

-- 
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/b4fb993b-fccd-4d10-9720-32676d60eb10n%40googlegroups.com.


Re: [prometheus-users] Should I lock the targets file when updating it?

2021-01-13 Thread Wang Yngwie
Thanks for your reply very much, it really helps. ☺

Julien Pivotto  于2021年1月13日周三 下午9:26写道:

> On 13 Jan 05:18, Wang Yngwie wrote:
> > I have a big targets file, it's about 8M size and there are more than
> > twenty thousand targetgroups. When Prometheus scans  sd_files, my
> updating
> > program might writing that file simultaneously. In that case, the
> Discovery
> > process may read part of the file or encounter an error. Is it possible
> and
> > should I lock the targets file while updating it?
>
> You should then create a .tmp.yml file, then move the file (rename) to
> the .yml, which is an atomic operation.
>
> >
> > --
> > 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/37552d38-afd6-4162-a7ee-4a3fb5262ad2n%40googlegroups.com
> .
>
>
> --
> Julien Pivotto
> @roidelapluie
>

-- 
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/CAC0bqNygxVaDywfMihFLCr6QFHCSLfjbY%3DqwZwXAr1h794ou1A%40mail.gmail.com.


[prometheus-users] Should I lock the targets file when updating it?

2021-01-13 Thread Wang Yngwie
I have a big targets file, it's about 8M size and there are more than 
twenty thousand targetgroups. When Prometheus scans  sd_files, my updating 
program might writing that file simultaneously. In that case, the Discovery 
process may read part of the file or encounter an error. Is it possible and 
should I lock the targets file while updating it?

-- 
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/37552d38-afd6-4162-a7ee-4a3fb5262ad2n%40googlegroups.com.