Custom metrics

46 views
Skip to first unread message

BHARATH KUMAR

unread,
May 9, 2022, 1:16:21 AM5/9/22
to Prometheus Users
Hi all,

I want number of active users and last time loggedin time. These metrics are not available directly from node exporter metrics. So we wrote some script which prometheus can understand.

we created cron job and made it run every one minute and it will gave those metrucs data which and integrated the same in grafana. we are getting data correctly but some times the data is appearing in the dashboard and sometmes its not appearing in dashboard. 

We are getting data for most of the servers but we were not getting for few. but when we refresh dashboard we are loosing info for some and we were getting info for some servers.

what can be the problem for ths? cron job or time duration of cron job or any? could anyone please help me out?

Thanks & regards,
Bharath Kumar

Julius Volz

unread,
May 9, 2022, 12:58:14 PM5/9/22
to BHARATH KUMAR, Prometheus Users
Hi,

How frequently are you scraping those metrics? If it's not at least every 5 minutes (better less), then the instant vector selectors in queries will sometimes not select any sample, since they only look back a maximum of 5m from a given resolution timestep.

Cheers,
Julius

--
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/e3367b3c-7cf5-4106-abd0-82903bd036a9n%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com

BHARATH KUMAR

unread,
May 10, 2022, 12:33:21 AM5/10/22
to Prometheus Users
I am running cron jo every one minute and in prometheus.yml file the scrape_interval is 15 seconds

Julius Volz

unread,
May 10, 2022, 3:06:54 AM5/10/22
to BHARATH KUMAR, Prometheus Users
Ok, weird. And I guess you are not using custom client-side timestamps in the textfile that would be more than 5 minutes apart? Could you share an excerpt?

Do you get the same missing-hosts behavior in the built-in expression browser in Prometheus? Would be interesting to see the expression, time settings, and maybe screenshots for two cases showing different hosts.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages