JavaScript is required to for searching.
ナビゲーションリンクをスキップ
印刷ビューの終了
Oracle Solaris 11.1 の管理: Oracle Solaris ゾーン、Oracle Solaris 10 ゾーン、およびリソース管理     Oracle Solaris 11.1 Information Library (日本語)
search filter icon
search icon

ドキュメントの情報

はじめに

パート I Oracle Solaris のリソース管理

1.  リソース管理の紹介

2.  プロジェクトとタスク (概要)

3.  プロジェクトとタスクの管理

4.  拡張アカウンティング (概要)

5.  拡張アカウンティングの管理 (タスク)

拡張アカウンティング機能の管理 (タスクマップ)

拡張アカウンティング機能の使用

フロー、プロセス、タスク、およびネットワークコンポーネントの拡張アカウンティングを起動する方法

拡張アカウンティングステータスを表示する方法

使用可能なアカウンティングリソースを表示する方法

プロセス、タスク、フロー、およびネットワーク管理のアカウンティングを停止する方法

libexacct に対する Perl インタフェースの使用

exacct オブジェクトの内容を再帰的に出力する方法

新しいグループレコードを作成してファイルに書き込む方法

exacct ファイルの内容を出力する方法

Sun::Solaris::Exacct::Object->dump() からの出力例

6.  リソース制御 (概要)

7.  リソース制御の管理 (タスク)

8.  公平配分スケジューラ (概要)

9.  公平配分スケジューラの管理 (タスク)

10.  リソース上限デーモンによる物理メモリーの制御 (概要)

11.  リソース上限デーモンの管理 (タスク)

12.  リソースプール (概要)

13.  リソースプールの作成と管理 (タスク)

14.  リソース管理の構成例

パート II Oracle Solaris ゾーン

15.  Oracle Solaris ゾーンの紹介

16.  非大域ゾーンの構成 (概要)

17.  非大域ゾーンの計画と構成 (タスク)

18.  非大域ゾーンのインストール、停止処理、停止、アンインストール、クローニングについて (概要)

19.  非大域ゾーンのインストール、ブート、停止処理、停止、アンインストール、およびクローニング (タスク)

20.  非大域ゾーンへのログイン (概要)

21.  非大域ゾーンへのログイン (タスク)

22.  ゾーンの移行と zonep2vchk ツールについて

23.  Oracle Solaris システムの移行と非大域ゾーンの移行 (タスク)

24.  ゾーンがインストールされている Oracle Solaris 11.1 システムでの自動インストールおよびパッケージ

25.  Oracle Solaris ゾーンの管理 (概要)

26.  Oracle Solaris ゾーンの管理 (タスク)

27.  不変ゾーンの構成と管理

28.  Oracle Solaris ゾーンで発生するさまざまな問題のトラブルシューティング

パート III Oracle Solaris 10 ゾーン

29.  Oracle Solaris 10 ゾーンの紹介

30.  Oracle Solaris 10 システムの評価とアーカイブの作成

31.  (オプション) Oracle Solaris 10 ゾーンへの Oracle Solaris 10 native 非大域ゾーンの移行

32.  solaris10 ブランドゾーンの構成

33.  solaris10 ブランドゾーンのインストール

34.  ゾーンのブート、ログイン、ゾーンの移行

用語集

索引

libexacct に対する Perl インタフェースの使用

exacct オブジェクトの内容を再帰的に出力する方法

exacct オブジェクトの内容を再帰的に出力するには、次のコードを使用します。この機能は、ライブラリによって Sun::Solaris::Exacct::Object::dump() 関数として提供されています。ea_dump_object() という簡易関数でこの機能を利用することもできます。

sub dump_object
     {
             my ($obj, $indent) = @_;
             my $istr = '  ' x $indent;

             #
             # Retrieve the catalog tag.  Because we are 
             # doing this in an array context, the
             # catalog tag will be returned as a (type, catalog, id) 
             # triplet, where each member of the triplet will behave as 
             # an integer or a string, depending on context.
             # If instead this next line provided a scalar context, e.g.
             #    my $cat  = $obj->catalog()->value();
             # then $cat would be set to the integer value of the 
             # catalog tag.
             #
             my @cat = $obj->catalog()->value();

             #
             # If the object is a plain item
             #
             if ($obj->type() == &EO_ITEM) {
                     #
                     # Note: The '%s' formats provide s string context, so
                     # the components of the catalog tag will be displayed
                     # as the symbolic values. If we changed the '%s'
                     # formats to '%d', the numeric value of the components
                     # would be displayed.
                     #
                     printf("%sITEM\n%s  Catalog = %s|%s|%s\n", 
                        $istr, $istr, @cat);
                     $indent++;

                     #
                     # Retrieve the value of the item.  If the item contains
                     # in turn a nested exacct object (i.e., an item or
                     # group),then the value method will return a reference
                     # to the appropriate sort of perl object
                     # (Exacct::Object::Item or Exacct::Object::Group).
                     # We could of course figure out that the item contained
                     # a nested item orgroup by examining the catalog tag in
                     # @cat and looking for a type of EXT_EXACCT_OBJECT or
                     # EXT_GROUP.
                     #
                     my $val = $obj->value();
                     if (ref($val)) {
                             # If it is a nested object, recurse to dump it.
                             dump_object($val, $indent);
                     } else {
                             # Otherwise it is just a 'plain' value, so
                             # display it.
                             printf("%s  Value = %s\n", $istr, $val);
                     }

             #
             # Otherwise we know we are dealing with a group.  Groups
             # represent contents as a perl list or array (depending on
             # context), so we can process the contents of the group
             # with a 'foreach' loop, which provides a list context.
             # In a list context the value method returns the content
             # of the group as a perl list, which is the quickest
             # mechanism, but doesn't allow the group to be modified.
             # If we wanted to modify the contents of the group we could
             # do so like this:
             #    my $grp = $obj->value();   # Returns an array reference
             #    $grp->[0] = $newitem;
             # but accessing the group elements this way is much slower.
             #
             } else {
                     printf("%sGROUP\n%s  Catalog = %s|%s|%s\n",
                         $istr, $istr, @cat);
                     $indent++;
                     # 'foreach' provides a list context.
                     foreach my $val ($obj->value()) {
                             dump_object($val, $indent);
                     }
                     printf("%sENDGROUP\n", $istr);
             }
     }

新しいグループレコードを作成してファイルに書き込む方法

新しいグループレコードを作成して /tmp/exacct というファイルに書き込むには、次のスクリプトを使用します。

#!/usr/bin/perl

use strict;
use warnings;
use Sun::Solaris::Exacct qw(:EXACCT_ALL);
# Prototype list of catalog tags and values.
     my @items = (
             [ &EXT_STRING | &EXC_DEFAULT | &EXD_CREATOR      => "me"       ],
             [ &EXT_UINT32 | &EXC_DEFAULT | &EXD_PROC_PID     => $$         ],
             [ &EXT_UINT32 | &EXC_DEFAULT | &EXD_PROC_UID     => $<         ],
             [ &EXT_UINT32 | &EXC_DEFAULT | &EXD_PROC_GID     => $(         ],
             [ &EXT_STRING | &EXC_DEFAULT | &EXD_PROC_COMMAND => "/bin/rec" ],
     );

     # Create a new group catalog object.
     my $cat = ea_new_catalog(&EXT_GROUP | &EXC_DEFAULT | &EXD_NONE)

     # Create a new Group object and retrieve its data array.
     my $group = ea_new_group($cat);
     my $ary = $group->value();

     # Push the new Items onto the Group array.
     foreach my $v (@items) {
             push(@$ary, ea_new_item(ea_new_catalog($v->[0]), $v->[1]));
     }

     # Open the exacct file, write the record & close.
     my $f = ea_new_file('/tmp/exacct', &O_RDWR | &O_CREAT | &O_TRUNC)
        || die("create /tmp/exacct failed: ", ea_error_str(), "\n");
     $f->write($group);
     $f = undef;

exacct ファイルの内容を出力する方法

exacct ファイルの内容を出力するには、次の Perl スクリプトを使用します。

#!/usr/bin/perl

     use strict;
     use warnings;
     use Sun::Solaris::Exacct qw(:EXACCT_ALL);

     die("Usage is dumpexacct <exacct file>\n") unless (@ARGV == 1);

     # Open the exacct file and display the header information.
     my $ef = ea_new_file($ARGV[0], &O_RDONLY) || die(error_str());
     printf("Creator:  %s\n", $ef->creator());
     printf("Hostname: %s\n\n", $ef->hostname());

     # Dump the file contents
     while (my $obj = $ef->get()) {
             ea_dump_object($obj);
     }

     # Report any errors
     if (ea_error() != EXR_OK && ea_error() != EXR_EOF)  {
             printf("\nERROR: %s\n", ea_error_str());
             exit(1);
     }
     exit(0);

Sun::Solaris::Exacct::Object->dump() からの出力例

「新しいグループレコードを作成してファイルに書き込む方法」で作成されたファイルに Sun::Solaris::Exacct::Object->dump() を実行した場合の出力例を示します。

Creator:  root
Hostname: localhost
GROUP
       Catalog = EXT_GROUP|EXC_DEFAULT|EXD_NONE
       ITEM
         Catalog = EXT_STRING|EXC_DEFAULT|EXD_CREATOR
         Value = me
       ITEM
         Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_PID
         Value = 845523
       ITEM
         Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_UID
         Value = 37845
       ITEM
         Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_GID
         Value = 10
       ITEM
         Catalog = EXT_STRING|EXC_DEFAULT|EXD_PROC_COMMAND
         Value = /bin/rec
ENDGROUP