psacct dump-acct で pid および ppid フィールドを有効にするにはどうすればよいでしょうか?

psacct dump-acct で pid および ppid フィールドを有効にするにはどうすればよいでしょうか?

現在、Centos の psacct パッケージを使用して、ユーザーが実行するプロセスのアカウンティングを実行しています。

情報ファイル1オペレーティング システムが struct acct で提供する情報に応じて、pid と ppid を出力できることを示唆しています。

私のシステムでは、pid と ppid は /usr/include/linux/acct.h にリストされています。

struct acct_v3
{
        char            ac_flag;                /* Flags */
        char            ac_version;             /* Always set to ACCT_VERSION */
        __u16           ac_tty;                 /* Control Terminal */
        __u32           ac_exitcode;            /* Exitcode */
        __u32           ac_uid;                 /* Real User ID */
        __u32           ac_gid;                 /* Real Group ID */
        __u32           ac_pid;                 /* Process ID */
        __u32           ac_ppid;                /* Parent Process ID */
...

しかし、dump-acct を実行しても pid と ppid は出力されません。

# dump-acct /var/account/pacct.1 | tail
awk              |   0.0|   0.0|  81.0|    0|    0|8792.0|Thu Nov 24 04:03:04 2011
tmpwatch         |   0.0|   0.0|   1.0|    0|    0|3816.0|Thu Nov 24 04:03:04 2011
cups             |   0.0|   0.0|   4.0|    0|    0|8728.0|Thu Nov 24 04:03:04 2011
awk              |   0.0|   0.0|   4.0|    0|    0|8792.0|Thu Nov 24 04:03:04 2011
runlevel         |   0.0|   0.0|   0.0|    0|    0|3804.0|Thu Nov 24 04:03:04 2011
chkconfig        |   0.0|   0.0|   0.0|    0|    0|3840.0|Thu Nov 24 04:03:04 2011
inn-cron-expire  |   0.0|   0.0|   0.0|    0|    0|8728.0|Thu Nov 24 04:03:04 2011
awk              |   0.0|   0.0|   0.0|    0|    0|8792.0|Thu Nov 24 04:03:04 2011
gzip             |   5.0|   0.0|   9.0|    0|    0|4044.0|Thu Nov 24 04:03:04 2011
accton           |   0.0|   0.0|   1.0|    0|    0|   0.0|Thu Nov 24 04:03:04 2011

私のカーネルではこの機能がサポートされていないか、または私の psacct バージョンがこれをサポートしていない可能性はありますか?

アカウンティング ログに pid と ppid を追加するにはどうすればよいですか?

CentOS リリース 5.6

カーネル 2.6.18-238.19.1.el5

psacct 6.3.2

答え1

私はこれを見つけたpsacct RPM の変更ログ:

* Fri Nov 13 2009 Ivana Varekova <varekova(at)redhat.com> - 6.3.2-56
  - fix the psacct to deal with all acct types and
    if it is possible and wanted then add the possibility
    to display the pid and ppid number

したがって、どのリリースを使用しているかによって正確に異なるようです。

答え2

CentOS release 5.6
psacct 6.3.2

psacctCentOS 5.6 に同梱されているパッケージのリリース番号は 44 です。

Name       : psacct
Arch       : x86_64
Version    : 6.3.2
Release    : 44.el5
Size       : 107 k
Repo       : installed
Summary    : Utilities for monitoring process activities.
License    : GPL
Description: The psacct package contains several utilities for monitoring process
           : activities, including ac, lastcomm, accton and sa. The ac command
           : displays statistics about how long users have been logged on. The
           : lastcomm command displays information about previous executed
           : commands. The accton command turns process accounting on or off. The
           : sa command summarizes information about previously executed
           : commands.

@Ladadadada が述べたように、変更ログによると、PID と PPID はバージョン 6.3.2-56 からのみ使用可能です。私の CentOS 6 (psacct-6.3.2-63) では次のようになります。

accton           |   0.0|   0.0|   1.0|    0|    0|3832.0|   16114    16111|Thu Nov 24 13:37:50 2011
touch            |   0.0|   0.0|   3.0|    0|    0|105088.0|   16115    16111|Thu Nov 24 13:37:50 2011
psacct           |   0.0|   0.0|   9.0|    0|    0|106304.0|   16111    16059|Thu Nov 24 13:37:50 2011
w                |   0.0|   0.0|   3.0|    0|    0|105280.0|   16116    16059|Thu Nov 24 13:37:52 2011

関連情報