[prometheus-users] ssl cert monitoring with blackbox exporter

2022-08-08 Thread nina guo
Hi,

I'm using following module to monitor ssl cert, but failed following issue.

tcp_cert:
prober: tcp
timeout: 5s
tcp:
  tls: true
  preferred_ip_protocol: "ip4"
  tls_config:
insecure_skip_verify: true

curl -g 
'http://1.1.1.1:9115/probe?module=tcp_cert=dns:587=true'
Logs for the probe:
ts=2022-08-09T01:23:27.020158973Z caller=main.go:320 module=tcp_cert 
target=dns:587 level=info msg="Beginning probe" probe=tcp timeout_seconds=5
ts=2022-08-09T01:23:27.020211226Z caller=tcp.go:40 module=tcp_cert 
target=dns:587 level=info msg="Resolving target address" ip_protocol=ip4
ts=2022-08-09T01:23:27.024779773Z caller=tcp.go:40 module=tcp_cert 
target=dns:587 level=info msg="Resolved target address" ip=2.2.2.2
ts=2022-08-09T01:23:27.024809314Z caller=tcp.go:121 module=tcp_cert 
target=dns:587 level=info msg="Dialing TCP with TLS"
ts=2022-08-09T01:23:27.02673954Z caller=main.go:130 module=tcp_cert 
target=dns:587 level=error msg="Error dialing TCP" err="tls: first record 
does not look like a TLS handshake"
ts=2022-08-09T01:23:27.026778527Z caller=main.go:320 module=tcp_cert 
target=dns:587 level=error msg="Probe failed" duration_seconds=0.00659328

-- 
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/cc2712cf-3845-4bb3-a6d0-d8085689da3cn%40googlegroups.com.


Re: [prometheus-users] node exporter text file collector

2022-08-08 Thread nina guo
Thank you. I moved this line before the loop, but still received the same 
issue.

On Tuesday, August 9, 2022 at 2:58:16 AM UTC+8 b...@ritcey.com wrote:

> Move 
>
>   g1 = Gauge('ldap_query_success', 'LDAP query command', ['ldap_uri', 
> 'ldap_search_base'], registry=registry)
>
> before the loop - you don't want to initialize it each time.
> On Monday, August 8, 2022 at 7:00:42 AM UTC-4 ninag...@gmail.com wrote:
>
>> Thank you I have resolved the issue.
>>
>> I also tried to use the interfaces to create and record the metrics. I 
>> have tested with following codes and found that the value of the metrcis 
>> will be overrided by the last value of the metrics.
>>
>> For example:
>> real situation is:
>> service1 -> ldap_query_success{...}  0
>> service2 -> ldap_query_success{...}  0
>> service3 -> ldap_query_success{...}  1
>>
>> but with the following codes:
>> service1 -> ldap_query_success{...}  1
>> service2 -> ldap_query_success{...}  1
>> service3 -> ldap_query_success{...}  1
>>
>>
>>
>> from prometheus_client import Gauge, write_to_textfile, CollectorRegistry
>>
>> for service in services:
>>   g1 = Gauge('ldap_query_success', 'LDAP query command', ['ldap_uri', 
>> 'ldap_search_base'], registry=registry)
>>   
>> g1.labels(service,ldap_search_base,ldap_default_bind_dn).set(query_check)
>>   write_to_textfile("/var/log 
>> node_exporter/filecollector/ldap_query.prom", registry)
>>
>>
>>
>> On Monday, August 8, 2022 at 5:31:29 PM UTC+8 Stuart Clark wrote:
>>
>>> On 08/08/2022 09:58, nina guo wrote: 
>>> > But the following 3 lines should be appended to a file first, then 
>>> > next time override the old content. But how to make the old content be 
>>> > overried by previous ones? 
>>> > 
>>> > print (" # HELP ldap_query_success LDAP query command", 
>>> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", 
>>> "a+")) 
>>> >  print (" # TYPE ldap_query_success gauge", 
>>> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", 
>>> "a+")) 
>>> > print 
>>> > 
>>> ('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
>>>  
>>>
>>> > '+str(query_check), 
>>> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", 
>>> "a+")) 
>>> > 
>>> File mode "a" will open for appending (so preserve anything already in 
>>> the file). Instead to fully replace the file you'd need to use file mode 
>>> "w". 
>>>
>>> -- 
>>> Stuart Clark 
>>>
>>>

-- 
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/e3e93c3e-fff4-433c-a870-a661d4a8c81an%40googlegroups.com.


[prometheus-users] Prometheus throwing unexpected EOF for targets

2022-08-08 Thread Kirti Ranjan Parida
Hi All 
I have deployed prometheus with prometheus operator.Our prometheus was 
running on 2.15.2 and recently we have upgraded prometheus to 2.36.1 along 
with prometheus operator to 0.57.0. 

After upgrade we are getting *unexpected EOF  *for targets.My issue looks 
simillar to the reported one 
https://github.com/prometheus/prometheus/issues/10213. 
I dont see any option to disable http2 with operator 0.57.0. How can I 
debug this  and how can I disable http2 

Thanks 
Kirti

-- 
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/ac353cc5-dec5-4835-9756-2e3d10178de7n%40googlegroups.com.


Re: [prometheus-users] node exporter text file collector

2022-08-08 Thread b...@ritcey.com
Move 

  g1 = Gauge('ldap_query_success', 'LDAP query command', ['ldap_uri', 
'ldap_search_base'], registry=registry)

before the loop - you don't want to initialize it each time.
On Monday, August 8, 2022 at 7:00:42 AM UTC-4 ninag...@gmail.com wrote:

> Thank you I have resolved the issue.
>
> I also tried to use the interfaces to create and record the metrics. I 
> have tested with following codes and found that the value of the metrcis 
> will be overrided by the last value of the metrics.
>
> For example:
> real situation is:
> service1 -> ldap_query_success{...}  0
> service2 -> ldap_query_success{...}  0
> service3 -> ldap_query_success{...}  1
>
> but with the following codes:
> service1 -> ldap_query_success{...}  1
> service2 -> ldap_query_success{...}  1
> service3 -> ldap_query_success{...}  1
>
>
>
> from prometheus_client import Gauge, write_to_textfile, CollectorRegistry
>
> for service in services:
>   g1 = Gauge('ldap_query_success', 'LDAP query command', ['ldap_uri', 
> 'ldap_search_base'], registry=registry)
>   g1.labels(service,ldap_search_base,ldap_default_bind_dn).set(query_check)
>   write_to_textfile("/var/log 
> node_exporter/filecollector/ldap_query.prom", registry)
>
>
>
> On Monday, August 8, 2022 at 5:31:29 PM UTC+8 Stuart Clark wrote:
>
>> On 08/08/2022 09:58, nina guo wrote: 
>> > But the following 3 lines should be appended to a file first, then 
>> > next time override the old content. But how to make the old content be 
>> > overried by previous ones? 
>> > 
>> > print (" # HELP ldap_query_success LDAP query command", 
>> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", 
>> "a+")) 
>> >  print (" # TYPE ldap_query_success gauge", 
>> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", 
>> "a+")) 
>> > print 
>> > 
>> ('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
>>  
>>
>> > '+str(query_check), 
>> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", 
>> "a+")) 
>> > 
>> File mode "a" will open for appending (so preserve anything already in 
>> the file). Instead to fully replace the file you'd need to use file mode 
>> "w". 
>>
>> -- 
>> Stuart Clark 
>>
>>

-- 
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/ab84a935-8c5c-464d-988c-ded7d87529a5n%40googlegroups.com.


Re: [prometheus-users] node exporter text file collector

2022-08-08 Thread nina guo
Thank you I have resolved the issue.

I also tried to use the interfaces to create and record the metrics. I have 
tested with following codes and found that the value of the metrcis will be 
overrided by the last value of the metrics.

For example:
real situation is:
service1 -> ldap_query_success{...}  0
service2 -> ldap_query_success{...}  0
service3 -> ldap_query_success{...}  1

but with the following codes:
service1 -> ldap_query_success{...}  1
service2 -> ldap_query_success{...}  1
service3 -> ldap_query_success{...}  1



from prometheus_client import Gauge, write_to_textfile, CollectorRegistry

for service in services:
  g1 = Gauge('ldap_query_success', 'LDAP query command', ['ldap_uri', 
'ldap_search_base'], registry=registry)
  g1.labels(service,ldap_search_base,ldap_default_bind_dn).set(query_check)
  write_to_textfile("/var/log node_exporter/filecollector/ldap_query.prom", 
registry)



On Monday, August 8, 2022 at 5:31:29 PM UTC+8 Stuart Clark wrote:

> On 08/08/2022 09:58, nina guo wrote:
> > But the following 3 lines should be appended to a file first, then 
> > next time override the old content. But how to make the old content be 
> > overried by previous ones?
> >
> > print (" # HELP ldap_query_success LDAP query command", 
> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
> >  print (" # TYPE ldap_query_success gauge", 
> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
> > print 
> > 
> ('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
>  
>
> > '+str(query_check), 
> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
> >
> File mode "a" will open for appending (so preserve anything already in 
> the file). Instead to fully replace the file you'd need to use file mode 
> "w".
>
> -- 
> Stuart Clark
>
>

-- 
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/633b11eb-89a2-4b91-b1c7-4df48912dcf5n%40googlegroups.com.


Re: [prometheus-users] node exporter text file collector

2022-08-08 Thread Stuart Clark

On 08/08/2022 09:58, nina guo wrote:
But the following 3 lines should be appended to a file first, then 
next time override the old content. But how to make the old content be 
overried by previous ones?


print (" # HELP ldap_query_success LDAP query command", 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
 print (" # TYPE ldap_query_success gauge", 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
print 
('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'} 
'+str(query_check), 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))


File mode "a" will open for appending (so preserve anything already in 
the file). Instead to fully replace the file you'd need to use file mode 
"w".


--
Stuart Clark

--
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/c7354142-2105-dd77-721c-255d557cc058%40Jahingo.com.


Re: [prometheus-users] node exporter text file collector

2022-08-08 Thread nina guo
But the following 3 lines should be appended to a file first, then next 
time override the old content. But how to make the old content be overried 
by previous ones?

print (" # HELP ldap_query_success LDAP query command", 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
 print (" # TYPE ldap_query_success gauge", 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
print 
('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
 
'+str(query_check), 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))

On Monday, August 8, 2022 at 4:43:00 PM UTC+8 Stuart Clark wrote:

> On 2022-08-08 09:14, nina guo wrote:
> > Hi,
> > 
> > I used the following way to output the metrics and values to a file,
> > and let node exporter to scrape it.
> > 
> > I have a question here, how to let the next metrics value overide the
> > previous'?
> > 
> > I checked .prom file, there are some metrics with same labels and same
> > values of labels but different value of the metrics. It is not
> > correct. The next value of the metrics should override the previous
> > old value. But how to implement this?
> > 
> > print (" # HELP ldap_query_success LDAP query command",
> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom",
> > "a+"))
> > print (" # TYPE ldap_query_success gauge",
> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom",
> > "a+"))
> > print
> > 
> ('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
> > '+str(query_check),
> > file=open("/var/log/node_exporter/filecollector/ldap_query.prom",
> > "a+"))
> > 
>
> You shouldn't be appending to an existing file, but instead replacing 
> the file contents each time you do an update.
>
> Depending on the tooling used it is often better to create a new file 
> with a random non *.prom filename and then rename it into the correct 
> name - renames are generally atomic whereas file updates often aren't, 
> meaning if you modify the file directly you could end up reading part 
> finished data.
>
> -- 
> Stuart Clark
>

-- 
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/defc65f8-744c-4428-97e6-a04e07e2c157n%40googlegroups.com.


Re: [prometheus-users] node exporter text file collector

2022-08-08 Thread Stuart Clark

On 2022-08-08 09:14, nina guo wrote:

Hi,

I used the following way to output the metrics and values to a file,
and let node exporter to scrape it.

I have a question here, how to let the next metrics value overide the
previous'?

I checked .prom file, there are some metrics with same labels and same
values of labels but different value of the metrics. It is not
correct. The next value of the metrics should override the previous
old value. But how to implement this?

print (" # HELP ldap_query_success LDAP query command",
file=open("/var/log/node_exporter/filecollector/ldap_query.prom",
"a+"))
 print (" # TYPE ldap_query_success gauge",
file=open("/var/log/node_exporter/filecollector/ldap_query.prom",
"a+"))
print
('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
'+str(query_check),
file=open("/var/log/node_exporter/filecollector/ldap_query.prom",
"a+"))



You shouldn't be appending to an existing file, but instead replacing 
the file contents each time you do an update.


Depending on the tooling used it is often better to create a new file 
with a random non *.prom filename and then rename it into the correct 
name - renames are generally atomic whereas file updates often aren't, 
meaning if you modify the file directly you could end up reading part 
finished data.


--
Stuart Clark

--
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/661c81dacfd90b1b59ed060aed4101f2%40Jahingo.com.


[prometheus-users] node exporter text file collector

2022-08-08 Thread nina guo
Hi,

I used the following way to output the metrics and values to a file, and 
let node exporter to scrape it.

I have a question here, how to let the next metrics value overide the 
previous'?

I checked .prom file, there are some metrics with same labels and same 
values of labels but different value of the metrics. It is not correct. The 
next value of the metrics should override the previous old value. But how 
to implement this?

print (" # HELP ldap_query_success LDAP query command", 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
 print (" # TYPE ldap_query_success gauge", 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))
print 
('ldap_query_success'+'{'+'ldap_uri'+'='+service+','+'ldap_search_base'+'='+ldap_search_base+','+'}
 
'+str(query_check), 
file=open("/var/log/node_exporter/filecollector/ldap_query.prom", "a+"))




-- 
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/dcc22492-559a-49b6-ab93-a39f426c259en%40googlegroups.com.


[prometheus-users] Documentation standards?

2022-08-08 Thread sayf.eddi...@gmail.com
Hello
We have a large product with multiple exporters within different teams.

I was wondering if there is a standard on how to document each 
application/exporter metrics and alerts. If not, Did you already encounter 
such issue and what direction did you choose.

Cheers

-- 
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/8235179d-e1e1-47ae-8914-3ae222407387n%40googlegroups.com.