Re: [systemd-devel] Keeping track of usage time

2015-11-03 Thread Tomasz Torcz
On Tue, Nov 03, 2015 at 07:27:39AM +0100, Umut Tezduyar Lindskog wrote:
> journalctl --list-boots seems great actually but wouldn't work for us.
> We cannot keep lots of logs in our products.
> 
> Ultimately we are trying to answer the question of how long one of our
> product has been in use.
> 
> We will implement it with a .timer/.service which periodically adds
> /proc/uptime to a file and the file gets preserved over reboot.

  Hi,

  there's a daemon which does this: https://github.com/rpodgorny/uptimed

It keeps database in file: 
9932957:1354374472:Linux 3.6.8-1.fc18.x86_64
7635334:1400571727:Linux 3.14.2-200.fc20.x86_64
…

  And has text frontend for interactive use:
% uprecords -M
 #   Uptime | System Boot up
+---
 1   114 days, 23:09:17 | Linux 3.6.8-1.fc18.x86_6  Sat Dec  1 16:07:52 2012
 288 days, 08:55:34 | Linux 3.14.2-200.fc20.x8  Tue May 20 09:42:07 2014
 372 days, 14:59:41 | Linux 3.8.8-203.fc18.x86  Sun Apr 28 18:17:18 2013
 468 days, 03:35:07 | Linux 3.17.1-302.fc21.x8  Mon Oct 20 08:53:07 2014
 566 days, 02:38:32 | Linux 3.12.5-302.fc20.x8  Sun Dec 29 14:38:53 2013
 665 days, 18:50:12 | Linux 3.13.5-202.fc20.x8  Sun Mar  9 20:36:38 2014
 761 days, 15:45:36 | Linux 3.18.1-2.fc22.x86_  Sat Dec 27 15:43:00 2014
 859 days, 12:08:43 | Linux 4.0.0-0.rc2.git0.1  Sun Mar 22 11:13:26 2015
 948 days, 13:06:38 | Linux 3.4.0-1.fc17.x86_6  Thu Jun  7 18:51:12 2012
1044 days, 02:41:34 | Linux 3.11.3-201.fc19.x8  Fri Oct 11 14:34:46 2013
+---
->  2917 days, 18:31:09 | Linux 4.2.3-200.fc22.x86  Fri Oct 16 16:07:22 2015
+---
1up in 0 days, 03:04:28 | atTue Nov  3 12:42:59 2015
t10 in26 days, 08:10:26 | atSun Nov 29 17:48:57 2015
no1 in97 days, 04:38:09 | atMon Feb  8 14:16:40 2016
mst in 7 days, 05:28:52 | twenty-five days  Tue Nov 10 15:07:23 2015
up  1413 days, 06:30:17 | since Sun Jan  1 03:11:26 2012
  down  -11 days, 00:-03:-1 | since Sun Jan  1 03:11:26 2012
   %up  100.785 | since Sun Jan  1 03:11:26 2012


  I see no need to merge it in systemd, really.

-- 
Tomasz Torcz   72->|   80->|
xmpp: zdzich...@chrome.pl  72->|   80->|

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Keeping track of usage time

2015-11-03 Thread Umut Tezduyar Lindskog
On Tue, Nov 3, 2015 at 1:20 PM, Dimitri John Ledkov
 wrote:
> On 3 November 2015 at 06:27, Umut Tezduyar Lindskog  wrote:
>> journalctl --list-boots seems great actually but wouldn't work for us.
>> We cannot keep lots of logs in our products.
>>
>
> You shouldn't need to keep lots of logs, just a timer unit that would
> query and store/transmit the bootids/deltas (possibly in a round-robin
> fashion)

That is how I am envisioning it. uptimed seems a bit complex for
something so simple.

>
> Regards,
>
> Dimitri.
>
>
>> Ultimately we are trying to answer the question of how long one of our
>> product has been in use.
>>
>> We will implement it with a .timer/.service which periodically adds
>> /proc/uptime to a file and the file gets preserved over reboot.
>>
>> Umut
>>
>> On Mon, Nov 2, 2015 at 7:00 PM, Lennart Poettering
>>  wrote:
>>> On Mon, 02.11.15 15:46, Umut Tezduyar Lindskog (u...@tezduyar.com) wrote:
>>>
 Hi,

 We would like to implement a feature to keep track of accumulated
 values of uptimes in our products. Tracked time will give us the total
 usage time of our product not just since last reboot (/proc/uptime).

 Is upstream interested in having such implementation?
>>>
>>> As Dimitri suggested: wouldn't a journalctl --list-boots invocation
>>> suffice for this?
>>>
>>> Or do you need this per-service? (where the journal should be able to
>>> provide you with the answer too, of course, but with a different line)
>>>
>>> Lennart
>>>
>>> --
>>> Lennart Poettering, Red Hat
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
>
> --
> Regards,
>
> Dimitri.
> 53 sleeps till Christmas, or less
>
> https://clearlinux.org
> Open Source Technology Center
> Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Keeping track of usage time

2015-11-03 Thread Dimitri John Ledkov
On 3 November 2015 at 06:27, Umut Tezduyar Lindskog  wrote:
> journalctl --list-boots seems great actually but wouldn't work for us.
> We cannot keep lots of logs in our products.
>

You shouldn't need to keep lots of logs, just a timer unit that would
query and store/transmit the bootids/deltas (possibly in a round-robin
fashion)

Regards,

Dimitri.


> Ultimately we are trying to answer the question of how long one of our
> product has been in use.
>
> We will implement it with a .timer/.service which periodically adds
> /proc/uptime to a file and the file gets preserved over reboot.
>
> Umut
>
> On Mon, Nov 2, 2015 at 7:00 PM, Lennart Poettering
>  wrote:
>> On Mon, 02.11.15 15:46, Umut Tezduyar Lindskog (u...@tezduyar.com) wrote:
>>
>>> Hi,
>>>
>>> We would like to implement a feature to keep track of accumulated
>>> values of uptimes in our products. Tracked time will give us the total
>>> usage time of our product not just since last reboot (/proc/uptime).
>>>
>>> Is upstream interested in having such implementation?
>>
>> As Dimitri suggested: wouldn't a journalctl --list-boots invocation
>> suffice for this?
>>
>> Or do you need this per-service? (where the journal should be able to
>> provide you with the answer too, of course, but with a different line)
>>
>> Lennart
>>
>> --
>> Lennart Poettering, Red Hat
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel



-- 
Regards,

Dimitri.
53 sleeps till Christmas, or less

https://clearlinux.org
Open Source Technology Center
Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Keeping track of usage time

2015-11-02 Thread Umut Tezduyar Lindskog
Hi,

We would like to implement a feature to keep track of accumulated
values of uptimes in our products. Tracked time will give us the total
usage time of our product not just since last reboot (/proc/uptime).

Is upstream interested in having such implementation?

Umut
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Keeping track of usage time

2015-11-02 Thread Dimitri John Ledkov
On 2 November 2015 at 14:46, Umut Tezduyar Lindskog  wrote:
> Hi,
>
> We would like to implement a feature to keep track of accumulated
> values of uptimes in our products. Tracked time will give us the total
> usage time of our product not just since last reboot (/proc/uptime).
>
> Is upstream interested in having such implementation?
>

Isn't that just the duration of each bootid from journal then?

Checkout output of:

$ journalctl --list-boots

-- 
Regards,

Dimitri.
63 sleeps till Christmas, or less

https://clearlinux.org
Open Source Technology Center
Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Keeping track of usage time

2015-11-02 Thread Lennart Poettering
On Mon, 02.11.15 15:46, Umut Tezduyar Lindskog (u...@tezduyar.com) wrote:

> Hi,
> 
> We would like to implement a feature to keep track of accumulated
> values of uptimes in our products. Tracked time will give us the total
> usage time of our product not just since last reboot (/proc/uptime).
> 
> Is upstream interested in having such implementation?

As Dimitri suggested: wouldn't a journalctl --list-boots invocation
suffice for this?

Or do you need this per-service? (where the journal should be able to
provide you with the answer too, of course, but with a different line)

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Keeping track of usage time

2015-11-02 Thread Umut Tezduyar Lindskog
journalctl --list-boots seems great actually but wouldn't work for us.
We cannot keep lots of logs in our products.

Ultimately we are trying to answer the question of how long one of our
product has been in use.

We will implement it with a .timer/.service which periodically adds
/proc/uptime to a file and the file gets preserved over reboot.

Umut

On Mon, Nov 2, 2015 at 7:00 PM, Lennart Poettering
 wrote:
> On Mon, 02.11.15 15:46, Umut Tezduyar Lindskog (u...@tezduyar.com) wrote:
>
>> Hi,
>>
>> We would like to implement a feature to keep track of accumulated
>> values of uptimes in our products. Tracked time will give us the total
>> usage time of our product not just since last reboot (/proc/uptime).
>>
>> Is upstream interested in having such implementation?
>
> As Dimitri suggested: wouldn't a journalctl --list-boots invocation
> suffice for this?
>
> Or do you need this per-service? (where the journal should be able to
> provide you with the answer too, of course, but with a different line)
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel