[systemd-devel] systemd unit transition timestamps

2021-06-10 Thread paul.niel...@fujitsu.com
om
[root@fedora ~]# systemctl show docker.service |grep -e 
"[Aa]ctive\(Enter\|Exit\)TimestampMonotonic\|ActiveState="
ActiveState=inactive
InactiveExitTimestampMonotonic=0
ActiveEnterTimestampMonotonic=0
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
[root@fedora ~]# systemctl start docker.service
[root@fedora ~]# systemctl show docker.service |grep -e 
"[Aa]ctive\(Enter\|Exit\)TimestampMonotonic\|ActiveState="
ActiveState=active
InactiveExitTimestampMonotonic=236961155
ActiveEnterTimestampMonotonic=239566035
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
[root@fedora ~]# systemctl restart docker.service
[root@fedora ~]# systemctl show docker.service |grep -e 
"[Aa]ctive\(Enter\|Exit\)TimestampMonotonic\|ActiveState="
ActiveState=active
InactiveExitTimestampMonotonic=248678504
ActiveEnterTimestampMonotonic=250223975
ActiveExitTimestampMonotonic=247649250
InactiveEnterTimestampMonotonic=248675514
[root@fedora ~]# systemctl stop docker.service
Warning: Stopping docker.service, but it can still be activated by:
  docker.socket
[root@fedora ~]# systemctl show docker.service |grep -e 
"[Aa]ctive\(Enter\|Exit\)TimestampMonotonic\|ActiveState="
ActiveState=inactive
InactiveExitTimestampMonotonic=248678504
ActiveEnterTimestampMonotonic=250223975
ActiveExitTimestampMonotonic=269146800
InactiveEnterTimestampMonotonic=270187047
[root@fedora ~]#



When I did my tests, I saw that for my dummy.service respective events were
emitted on the dbus after systemctl stop that contained the correct timestamps.
So they seem to be cleared afterwards.

I'm not really familiar with the systemd code. Looking into it, I found that
the timestamps are set in unit_notify(). But this obviously works, considering
the events on the dbus.

I found one more difference when I monitored the dbus: For the dummy.service
there's an UnitRemoved() event, but not for the docker.service. If I read that
correct, it means that the unit object is removed from the d-bus and therefore
the timestamps are lost. Am I right?

So, anyways, I don't see the difference between the units that causes the
different behavior. Furthermore, from my point of view (as a user) it
contradicts the description of the Timestamp values in the man page somehow,
where it says "recorded on this boot".

Is this behaviour intended? Or is there another way to read the times a unit
was stopped, without setting up my own event listener or searching the
(potentially rotated/vacuumed) journal?

I tested on the latest Fedora 34 Workstation release with
  systemd 248 (v248-2.fc34)
and on openSUSE as well as on SLES12 (this is actually my target system) with
older versions.

Cheers,
Paul

---
With best regards
Paul Nieleck
Associate Software Developer
FJ CE EPS BS2000 DS OS4


FUJITSU
Mies-van-der-Rohe-Straße 8, 80807 München, Germany
Tel.: +49 (89) 62060 2933
E-mail: [email protected]
Web: ts.fujitsu.com
Company details: Fujitsu Technology Solutions GmbH / ts.fujitsu.com/imprint
This communication contains information that is confidential, proprietary in 
nature and/or privileged.  It is for the exclusive use of the intended 
recipient(s). If you are not the intended recipient(s) or the person 
responsible for delivering it to the intended recipient(s), please note that 
any form of dissemination, distribution or copying of this communication is 
strictly prohibited and may be unlawful. If you have received this 
communication in error, please immediately notify the sender and delete the 
original communication. Thank you for your cooperation.
Please be advised that neither Fujitsu, its affiliates, its employees or agents 
accept liability for any errors, omissions or damages caused by delays of 
receipt or by any virus infection in this message or its attachments, or which 
may otherwise arise as a result of this e-mail transmission.


___
systemd-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd unit transition timestamps

2021-06-10 Thread paul.niel...@fujitsu.com
Hi Uoti,

Thanks a lot for your answer.
I wasn't aware of the garbage collector.
Just after your mail I saw that it is "now" described in the systemd.unit man 
page, with all answers to my question. :D
As I said, unfortunately, we use a fairly outdated version (228) that ships 
with SLES12 and this version's man page has no info about the garbage 
collection.

Best regards,
Paul

Paul Nieleck
Associate Software Developer, CE EPS BS2000 DS OS4
Fujitsu
Mies-van-der-Rohe-Straße 8, 80807 München
Germany
Email: [email protected]
Web: https://www.fujitsu.com/emeia/

___
systemd-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/systemd-devel