如何以epoch格式显示sadf的时间

mij*_*000 3 ubuntu centos timestamps sysstat

我在 ubuntu 和 centos 之间的 sadf 中遇到问题。问题是日期在两者中的显示方式。

Ubuntu:

root@db1:/usr/local/nagios/libexec/nrpe_local# sadf | head -10
db1.oas3.realmedia.xstrat.us  300   2014-05-15 03-05-01 UTC all     %%user  0.14
db1.oas3.realmedia.xstrat.us  300   2014-05-15 03-05-01 UTC all     %%nice  0.00
Run Code Online (Sandbox Code Playgroud)

Centos:

[root@ui1 jboss]# sadf | head -5
ui1.oas3.realmedia.xstrat.us    595     1400123401      all     %user   1.00
ui1.oas3.realmedia.xstrat.us    595     1400123401      all     %nice   0.00
Run Code Online (Sandbox Code Playgroud)

我需要在 ubuntu 中显示时间,因为它以centos(纪元时间)显示。

我没有幸运地找到一些可以解决这个问题的配置文件。

cuo*_*glm 6

您应该查看sadf联机帮助页以确切了解哪个选项将显示自纪元时间以来的秒数,sysstat.

使用我的 Ubuntu 12.04.4 LTS:

$ sadf -V
sysstat version 10.0.3
(C) Sebastien Godard (sysstat <at> orange.fr)
Run Code Online (Sandbox Code Playgroud)

在这个版本中,显示纪元时间的选项是-T

-T     Display timestamp (UTC - Coordinated Universal Time) in  seconds
       from the epoch.
Run Code Online (Sandbox Code Playgroud)

但是对于sysstat 8.1.2-2,这个选项是-D.

-D     This  option  is  equivalent to option -d below, except that the
       timestamp  is  always  expressed  in  seconds  since  the  epoch
       (00:00:00 UTC 01/01/1970).
Run Code Online (Sandbox Code Playgroud)