1. That question doesn't seem to be related to this thread.
2. You've said this gives a "wrong alert", without showing the alert, 
saying what's "wrong" with it, or how you want it to behave instead.

Personally I use a rule like this:

      - alert: rebootNode
        expr: node_boot_time_seconds > (node_boot_time_seconds offset 5m + 
5)
        labels:
          severity: warning
        annotations:
          summary: 'Device rebooted at {{ $value | humanizeTimestamp }}'

On Wednesday, 27 April 2022 at 15:43:02 UTC+2 [email protected] wrote:

> changes(node_boot_time_seconds{job="kubernetes-service-endpoints"} [1h])
>
> Above query giving wrong alert on reboot, can you provide me the better 
> query
>
> On Friday, April 22, 2022 at 12:26:59 AM UTC+5:30 Brian Candler wrote:
>
>> On Thursday, 21 April 2022 at 19:40:07 UTC+1 [email protected] wrote:
>>
>>> Thanks a lot for your valuable inputs and suggestions. 
>>> *query1:*
>>> I had created with python with  Prometheus-client library,  I want to 
>>> execute this lib as Pod so need to create docker 
>>> image(python,prometheus-client ).
>>> here size of the image is going up to 130+mb and also CPU core 
>>> utilization is more. Only for few 4 to 6 custom metrics its consuming 
>>> approximate 1 core.
>>>
>>> Do you have any idea to minimize the CPU utilization
>>>
>>
>> In principle it should use zero cores while it's idle.  Normally an 
>> exporter only does work when it's being scraped (i.e. handling an incoming 
>> http request).  If that's not the case, then it's doing whatever you told 
>> it to do.  Maybe you have an infinite loop or something in your code?
>>
>> If you copied their sample code:
>>
>> if __name__ == '__main__':
>>     # Start up the server to expose the metrics.
>>     start_http_server(8000)
>>     # Generate some requests.
>> *    while True:*
>> *        process_request(random.random())*
>>
>> then clearly you'll be using a whole CPU core as this loop spins as fast 
>> as it can.  This is not meant to be how a real exporter works.  Rather, 
>> when your application does some other work (e.g. processing an incoming 
>> HTTP request) it can also increment counters or whatever.
>>
>>  
>>
>>> *query2:*
>>> When I am using this lib , I can still see some unwanted metrics are 
>>> populating other than mu custom metrics. Do you have any idea like jow I 
>>> can remove it from my metrics list?
>>>
>>>
>> Can you show the metrics?
>>
>

-- 
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/d4cb49a5-8218-4880-b6ce-9b3295aa6381n%40googlegroups.com.

Reply via email to