last_time_user_logged_in{hostname="5g-automation",instance="some-ip",job="node_exporter",loggedintime="May
10 10:19"}
4
last_time_user_logged_in{hostname="LOGSERVER",instance="some-ip",job="node_exporter",loggedintime="May
6 15:27"}
now it is showing loggedintime in prometheus UI but exactly after 1 minute
it is not displaying data for another 15-20 seconds and again its working
fine.
my script file :
totaluser=$(who | wc -l)
dummyuser=$(who | grep "($central_ip_address)" | wc -l)
activeuser=$(($totaluser-$dummyuser))
userloggedin=$(last | grep -v $central_ip_address | head -n 1 | awk '{print
$5,$6,$7}')
hostname=$(hostname)
ip=$(hostname -I | awk '{print $1}')
echo -e "# to find number of active user"
echo -e "number_active_user{hostname=\"$hostname\"} $activeuser"
echo -e "# time when user last loggedin"
echo -e
"last_time_user_logged_in{hostname=\"$hostname\",loggedintime=\"$userloggedin\"}
$activeuser"
On Tuesday, 10 May 2022 at 12:36:54 UTC+5:30 [email protected] wrote:
> 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.
>
> On Tue, May 10, 2022 at 6:33 AM BHARATH KUMAR <[email protected]>
> wrote:
>
>> I am running cron jo every one minute and in prometheus.yml file the
>> scrape_interval is 15 seconds
>>
>> On Monday, 9 May 2022 at 22:28:14 UTC+5:30 [email protected] wrote:
>>
>>> 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
>>>
>>> On Mon, May 9, 2022 at 7:16 AM BHARATH KUMAR <[email protected]>
>>> wrote:
>>>
>>>> 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
>>>>
>>>> --
>>>> 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/e3367b3c-7cf5-4106-abd0-82903bd036a9n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/prometheus-users/e3367b3c-7cf5-4106-abd0-82903bd036a9n%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 [email protected].
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/prometheus-users/0915647a-2448-4e20-89db-3ae6b8a4fd45n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/prometheus-users/0915647a-2448-4e20-89db-3ae6b8a4fd45n%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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/69907aa6-2210-4f42-af3b-06971aa8bc16n%40googlegroups.com.