Translated message

A translation of this page exists in English.

sar データが前月のファイルに追加される

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • sysstat

Issue

  • sar がデータを前月に追加する場合があります。この問題は、通常 2 月から 3 月になる時に発生します。これは、一般的に以下が原因で発生すると見なされます。

    • sar ファイルの 2 日分のデータ
    • 今月のデータが先月の最終日として保存されます。
  • sar レポートファイルが示す月が間違っています。

Resolution

  • RHEL 6 の場合は RHBA-2014-1468 を適用してください。

  • RHEL 5 の場合は RHBA-2010-0552 を適用してください。

  • RHEL 4 の場合は、/etc/sysconfig/sysstat を編集して 'HISTORY=25' パラメーター値を設定してください。

Root Cause

  • find(1) の man ページを確認すると、"any fractional part [of a 24-hour period] is ignored."という警告が記載されています。

       Numeric arguments can be specified as
              +n     for greater than n,
       ...    
       -atime n
              File  was  last  accessed n*24 hours ago.When find figures out
              how many 24-hour periods ago the file  was  last  accessed,  any
              fractional part is ignored, so to match -atime +1, a file has to
              have been accessed at least two days ago.
       ...
       -mtime n
              File’s  data was last modified n*24 hours ago.See the comments
              for -atime to understand how rounding affects the interpretation
              of file modification times.
    
  • /usr/lib64/sa/sa2 cron ジョブが、以下のコマンドを実行します。

#   find ...-mtime +"${HISTORY}" ...
  • この場合、$HISTORY26 に設定されます。
  • +26 は「27 日以降」を示していて、本日の一部のデータと、ファイルが修正された日の一部のデータが投げられ、DST 時間変更の余分の一部のデータが「28 日」になります。2 月が 28 日の場合は不足しているため古いファイルが削除されません。
  • したがって、問題が発生しないようにするためには、$HISTORY の数値を最大 25 日とする必要があります。
  • あるいは、デフォルトの 7 日を使用してローカルの cron ジョブを作成し、長期保存用のデータとして /var/log/sa に毎日コピーするようにします。

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments