検索クエリーを入力してください
<book_title> を検索 ...
Cluster Server 7.3.1 エージェント開発者ガイド - AIX、Linux、Solaris、Windows
Last Published:
2018-01-17
Product(s):
InfoScale & Storage Foundation (7.3.1)
- 概要
- エージェントのエントリポイントの概要
- エージェントのエントリポイントについて
- エージェントエントリポイントの説明
- action エントリポイントについて
- info エントリポイントについて
- C++ またはスクリプトエントリポイントの使用上の注意事項
- エージェント情報ファイルについて
- ArgList 属性と ArgListValues 属性について
- C++ でのエントリポイントの作成
- C++ でのエントリポイントの作成について
- C++ のエントリポイントの構文
- エージェントフレームワークの基本関数
- コンテナサポートのためのエージェントフレームワーク基本関数
- スクリプトでのエントリポイントの作成
- スクリプトでのエントリポイントの作成について
- スクリプトエントリポイントの構文
- エージェントフレームワークの基本関数
- VCSAG_GET_ATTR_VALUE
- コンテナをサポートするエージェントフレームワーク基本関数
- スクリプトのエントリポイントの例
- エージェントメッセージのログ
- カスタムエージェントの作成
- スクリプトベースの IMF 対応カスタムエージェントの作成
- エージェントのテスト
- 静的タイプ属性
- 静的属性について
- 静的タイプ属性の定義
- AdvDbg
- ArgList
- 状態の遷移図
- 国際化されたメッセージ
- First Failure Data Capture(FFDC)を使用した VCS リソースの予期しない動作のトラブルシューティング
- 付録 A. 5.0 より前の VCS エージェントの使用
例: UNIX での C++ エントリポイントの使用
このセクションの例では、独自の VCSAgStartup 関数、C++ バージョンの online、offline および monitor エントリポイントを使用して、FileOnOff エージェントを作成する方法を示します。この例では、VCSAgStartup、online、offline および monitor エントリポイントのみを実装します。
VCSAgStartup と C++ エントリポイントを使用するには
- agent.C ファイルを任意のエディタを使って開き、VCSAgStartup() 関数(このファイルの最後の数行)を次の例に合わせて修正します。
// Description: This functions registers the entry points // void VCSAgStartup() { VCSAG_LOG_INIT("VCSAgStartup"); VCSAgSetLogCategory(10051); VCSAgInitEntryPointStruct(V51); VCSAgValidateAndSetEntryPoint(VCSAgEPMonitor, res_monitor); VCSAgValidateAndSetEntryPoint(VCSAgEPOnline, res_online); VCSAgValidateAndSetEntryPoint(VCSAgEPOffline, res_offline); }
- res_online() を修正します。
// This is a C++ implementation of the online entry // point for the FileOnOff resource type. This function // brings online a FileOnOff resource by creating the // corresponding file. It is assumed that the complete // pathname of the file will be passed as the first // ArgList attribute. unsigned int res_online(const char *res_name, void **attr_val) { int fd = -1; int ret = 0; char *pathname = NULL; VCSAG_LOG_INIT("res_online"); /* * Get PathName attribute form attr_val parameter, passed to res_online function and store * it under pathname variable. * */ if (NULL == pathname) { return 0; } VCSAG_LOGDBG_MSG(VCS_DBG2, VCS_DEFAULT_FLAGS, "Creating file %s", pathname); if ((fd = open(pathname, S_IRUSR|S_IWUSR)) < 0) { VCSAG_LOG_MSG(VCS_ERROR, 2003, VCS_DEFAULT_FLAGS, "Attempt to create the file failed with errno=%d", errno); VCSAG_CONSOLE_LOG_MSG(VCS_ERROR, 2003, VCS_DEFAULT_FLAGS, "Attempt to create the file failed with errno=%d", errno); } else { close(fd); } return 0; }
- res_offline() を修正します。
// Function: res_offline // Description: This function deletes the file // unsigned int res_offline(const char *res_name, void **attr_val) { char *pathname = NULL; VCSAG_LOG_INIT("res_offline"); /* * Get PathName attribute form attr_val parameter, passed to res_offline function and store * under pathname variable. * */ if (NULL == pathname) { return 0; /* success: nothing to remove */ } VCSAG_LOGDBG_MSG(VCS_DBG2, VCS_DEFAULT_FLAGS, "Removing file %s", pathname); if ((0 != remove(pathname)) && (ENOENT != errno)) { VCSAG_LOG_MSG(VCS_ERROR, 2002, VCS_DEFAULT_FLAGS, "Attempt to remove the file failed with errno=%d", errno); VCSAG_CONSOLE_LOG_MSG(VCS_ERROR, 2002, VCS_DEFAULT_FLAGS, "Attempt to remove the file failed with errno=%d", errno); return 1; /* failure: attempt to remove failed */ } return 0; /* success: file removed */ }
- res_monitor() 関数を修正します。
例: UNIX での C++ およびスクリプトエントリポイントの使用を参照してください。
- agent.C をコンパイルし、make コマンドを実行してエージェントを作成します(標準添付の Makefile を使います)。
make
- エージェントバイナリのディレクトリを作成します。
mkdir /opt/VRTSvcs/bin/FileOnOff
- FileOnOff エージェントをインストールします。
make install AGENT=FileOnOff