差分
このページの2つのバージョン間の差分を表示します。
ja:documentation:04_using:04_inventory [2023/11/08 06:06] – [セキュリティ監視] junichi | ja:documentation:04_using:04_inventory [Unknown date] (現在) – 削除 - 外部編集 (Unknown date) 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== インベントリ ====== | ||
- | |||
- | {{indexmenu_n> | ||
- | |||
- | [[: | ||
- | |||
- | |||
- | |||
- | ===== 概要 ===== | ||
- | |||
- | Pandora FMS allows you to maintain an inventory of the devices monitored by Pandora FMS. With this inventory it is possible to maintain [[: | ||
- | |||
- | Pandora FMS を使用すると、Pandora FMS によって監視されているデバイスのインベントリを保持できます。このインベントリにより、次のような [[: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | * {{: | ||
- | |||
- | ===== インベントリデータ収集 ===== | ||
- | |||
- | The inventory is independent of monitoring and can be obtained: | ||
- | |||
- | インベントリは監視とは独立しており、次のように取得できます。 | ||
- | |||
- | * [[: | ||
- | * [[: | ||
- | |||
- | * インベントリモジュールを介して、Pandora FMS に統合されたスクリプトで、[[: | ||
- | * エージェントプラグインを介して[[: | ||
- | |||
- | ==== インベントリモジュール ==== | ||
- | |||
- | Inventory Modules are remote Modules that execute a command against a remote machine. These Modules work similarly to a plugin. The same modules can be defined as local when they obtain data through a Software Agent. | ||
- | |||
- | インベントリモジュールは、リモートのマシンにコマンドを実行するリモートモジュールです。これらのモジュールは、プラグインと同じように動作します。エージェントを通してデータを取得するローカルモジュールと同じものを定義することができます。 | ||
- | |||
- | <WRAP center round tip 90%> | ||
- | |||
- | In the **User** and **Password** parameters you can use the following [[: | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 90%> | ||
- | |||
- | **ユーザ**および**パスワード**では、'' | ||
- | |||
- | </ | ||
- | |||
- | ==== リモートインベントリ ==== | ||
- | |||
- | With Pandora FMS Enterprise, a good number of inventory modules are installed by default and it also allows you to build new inventory modules, modify, delete and customize those that already exist using the inventory module editor. | ||
- | |||
- | Pandora FMS Enterprise では、多数のインベントリ モジュールがデフォルトでインストールされており、インベントリモジュールエディタを使用して新しいインベントリモジュールを作成したり、既存のインベントリモジュールを変更、削除、カスタマイズしたりすることもできます。 | ||
- | |||
- | === リモートモジュールの作成 === | ||
- | |||
- | In the menu **Management** → **Configuration** → **Inventory Modules** you can see this list, and with the **Create** button add a new one. | ||
- | |||
- | **管理(Management)** → **設定(Configuration)** → **インベントリモジュール(Inventory Modules)** メニューから一覧が表示され、**作成(Create)** ボタンを押すと新規追加できます。 | ||
- | |||
- | Some important fields: | ||
- | |||
- | 重要なフィールドは次の通りです。 | ||
- | |||
- | * **Interpreter**: | ||
- | * **Code**: | ||
- | * **Block mode**: [[: | ||
- | * **Format:** Type the fields separated by '' | ||
- | |||
- | * **インタープリタ(Interpreter): | ||
- | * **コード(Code): | ||
- | * **ブロックモード(Block mode):** 設定の [[: | ||
- | * **フォーマット(Format): | ||
- | |||
- | <WRAP center round important 90%> | ||
- | |||
- | * In **Format** make sure to place each and every field separated by semicolons. If you omit this field you will not be able to create or save an inventory module and you will **lose any changes made**. | ||
- | * It is very important to choose the corresponding operating system because when adding inventory modules to an agent, only those modules will appear in which the operating system of the module matches the operating system of the agent. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 90%> | ||
- | |||
- | * **フォーマット(Format)**では、各フィールドをセミコロンで区切って配置してください。 このフィールドを省略すると、インベントリモジュールを作成または保存できなくなり、**行われた変更はすべて失われます**。 | ||
- | * インベントリモジュールをエージェントに追加すると、モジュールのオペレーティングシステムがエージェントのオペレーティングシステムと一致するモジュールのみが表示されるため、対応するオペレーティングシステムを選択することが非常に重要です。 | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | === リモートモジュールの割当 === | ||
- | |||
- | The assignment of Inventory Modules is carried out in the Agent itself, in the Agent administration tab, click on the **Inventory** tab. | ||
- | |||
- | インベントリモジュールの割り当ては、エージェント自体で実行されます。エージェント管理タブで、**インベントリ** タブをクリックします。 | ||
- | |||
- | * **Module**: Choose the inventory module that needs to be added. Only modules whose Operating System matches that of the Agent will appear. | ||
- | * **Target**: IP address or name of the server from which you want to retrieve the inventory. | ||
- | * **Interval**: | ||
- | |||
- | * **モジュール(Module)**: | ||
- | * **対象(Target)**: | ||
- | * **間隔(Interval)**: | ||
- | |||
- | It is possible to define fields instead of the username and password that normally exist, for this it is necessary to activate the **Use custom fields** field. After doing this, a control will appear to add new fields (**Add field**). | ||
- | |||
- | 通常存在するユーザ名とパスワードの代わりにフィールドを定義することができます。そのためには、**カスタムフィールドの利用(Use custom fields)** を有効化する必要があります。 これを行うと、新しいフィールドを追加するためのコントロールが表示されます (**フィールド追加(Add field)**)。 | ||
- | |||
- | * In this control you will have to enter the desired name before adding it. | ||
- | * If you indicate that the field will contain a password, type **It`s a password** and the value will be saved in the database in an obfuscated manner. | ||
- | * After creating the fields, you can give them a value and finally add the Module. | ||
- | * These fields will be applied in order of creation in the execution of the remote inventory script. | ||
- | |||
- | * このコントロールでは、追加する前に希望の名前を入力する必要があります。 | ||
- | * フィールドにパスワードを含めるようにする場合は、**It' | ||
- | * フィールドを作成した後、フィールドに値を指定し、最後にモジュールを追加できます。 | ||
- | * これらのフィールドは、リモートインベントリスクリプトの実行時に作成順に適用されます。 | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ==== ソフトウエアエージェントによるローカルインベントリ ==== | ||
- | |||
- | Through Software Agents it is possible to obtain inventory data for a machine. It will be enough to apply the corresponding inventory modules in the [[: | ||
- | |||
- | ソフトウエアエージェントを通してインベントリデータを取得することができます。[[: | ||
- | |||
- | As with remote modules, it is also necessary to add these modules as an inventory module in **Management** → **Configuration** → **Inventory modules**. | ||
- | |||
- | リモートモジュールと同様に、これらのモジュールは、**管理(Management)** → **設定(Configuration)** → **インベントリモジュール(Inventory modules)** でインベントリモジュールとして追加する必要があります。 | ||
- | |||
- | === ローカルモジュールの作成 === | ||
- | |||
- | To create a local Module go to **Management** → **Configuration** → **Inventory modules** where all the inventory modules that have been created appear. All modules that will be defined in the Agent configuration must be created here; The operating system assigned to the Agent in the console must also match that of the created Module. | ||
- | |||
- | ローカルモジュールを作成するには、**管理(Management)** → **設定(Configuration)** → **インベントリモジュール(Inventory modules)** へ行きます。作成済みの全インベントリモジュールが表示されます。エージェント設定内で定義されるすべてのモジュールを作成します。 コンソール上でエージェントに割り当てられた OS は、作成されたモジュールの OS と一致する必要があります。 | ||
- | |||
- | The procedure is the same used for the remote case, except for filling in the **Interpreter** and **Code** fields. To edit the newly created inventory module (as well as all others) click either the name or the wrench icon. | ||
- | |||
- | 手順は、**インタプリター(Interpreter)** および **コード(Code)** フィールドを設定すること以外、リモートの場合と同じです。新しく作成したインベントリモジュール (その他すべてのモジュール) を編集するには、名前またはスパナアイコンをクリックします。 | ||
- | |||
- | === ソフトウエアエージェントによる Windows のインベントリモジュール === | ||
- | |||
- | <WRAP center round tip 90%> | ||
- | |||
- | These plugins come by default with the installation of the software agent, although they are commented in the configuration file, to use them uncomment such lines and restart the software agent (in the Enterprise version the software agents can be restarted due to their remote configuration). | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 90%> | ||
- | |||
- | これらのプラグインは、ソフトウェアエージェントのインストール時にデフォルトで導入されていますが、設定ファイル内でコメントアウトされています。利用する場合はコメントを外し、ソフトウェア エージェントを再起動します (Enterprise 版では、リモート設定によりソフトウェアエージェントを再起動できます)。 | ||
- | |||
- | </ | ||
- | |||
- | Example for MS Windows®: | ||
- | |||
- | MS Windows® の例: | ||
- | |||
- | < | ||
- | |||
- | # | ||
- | # | ||
- | # | ||
- | #module_end | ||
- | |||
- | </ | ||
- | |||
- | More items can be downloaded from the script collection [[https:// | ||
- | |||
- | 追加の設定は、スクリプトコレクション [[https:// | ||
- | |||
- | === ソフトウエアエージェントによる UNIX のインベントリモジュール === | ||
- | |||
- | The Unix Software Agent module uses, locally, a plugin to collect information about different aspects of the machine, both software and hardware. | ||
- | |||
- | Unix のソフトウエアエージェントのモジュールは、マシンのソフトウエアおよびハードウエア情報を取得するためにローカルで定義されたプラグインを利用します。 | ||
- | |||
- | The plugin that collects the inventory is in the directory ''/ | ||
- | |||
- | インベントリーを収集するプラグインはディレクトリ ''/ | ||
- | |||
- | The Module syntax is as follows: | ||
- | |||
- | モジュールの書式は次の通りです。 | ||
- | |||
- | < | ||
- | |||
- | module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route | ||
- | |||
- | </ | ||
- | |||
- | The Module is made up of a line with the following parameters: | ||
- | |||
- | モジュールは、次のパラメータを一行で設定します。 | ||
- | |||
- | * Module Activation: | ||
- | |||
- | * モジュールの有効化 | ||
- | |||
- | < | ||
- | " | ||
- | |||
- | </ | ||
- | |||
- | * Field where it is established how many days the Module will be executed. If it is zero (0) the inventory is returned **on each Agent execution**. | ||
- | |||
- | * モジュールの実行間隔 (日単位) の設定。値が 0 の場合は、エージェントの実行時にインベントリ情報が送信されます。 | ||
- | |||
- | < | ||
- | module_plugin inventory " | ||
- | |||
- | </ | ||
- | |||
- | * Field where the inventory objects that are collected are defined. | ||
- | |||
- | * 収集するインベントリの対象の設定 | ||
- | |||
- | < | ||
- | module_plugin inventory 1 "cpu ram video nic hd cdrom software init_services filesystem users route" | ||
- | |||
- | </ | ||
- | |||
- | You can also simply specify that it collect all available information. In this example, you will collect all inventory information daily: | ||
- | |||
- | 利用可能なすべての情報を収集するように指定することもできます。 この例では、すべてのインベントリ情報を毎日収集します。 | ||
- | |||
- | < | ||
- | # Plugin for inventory on the agent (Enterprise Only) | ||
- | module_plugin inventory 1 | ||
- | |||
- | </ | ||
- | |||
- | To activate the Inventory Module, copy the code described above and add it to the '' | ||
- | |||
- | インベントリモジュールを有効化するには、上記の設定をソフトウエアエージェントの '' | ||
- | |||
- | === ローカルモジュールの割当 === | ||
- | |||
- | It is unnecessary to activate the Modules in the Agents defined in the Console: | ||
- | |||
- | エージェントで定義したモジュールはコンソールで有効化する必要はありません。 | ||
- | |||
- | * If the modules have been created in **Configuration** → **Inventory modules.** | ||
- | * If the operating system matches and execution is defined in the Software Agent configuration file. | ||
- | * The collected data will appear directly in the **View** → **Inventory** section of the Agent in the Console. | ||
- | |||
- | * **設定(Configuration)** → **インベントリモジュール(Inventory modules)** をクリックしてモジュールが作成され、 | ||
- | * ソフトウエアエージェントの設定ファイルに設定された OS が一致すれば、 | ||
- | * コンソール上のエージェントの **表示(view)** → **インベントリ(inventory)** に現れます。 | ||
- | |||
- | === ソフトウエアエージェントでのローカルインベントリモジュールの作成 === | ||
- | |||
- | In addition to the inventory systems that come preconfigured in the Agent, Inventory Modules can be created for Unix® and MS Windows® systems. Basically you have to create a script thatgenerate an XML with the following structure: | ||
- | |||
- | エージェントにあらかじめ設定されたインベントリシステムに加えて、Unix® および MS Windows® システム用のインベントリモジュールを作成できます。 基本的には、次の構造の XML を生成するスクリプトを作成する必要があります。 | ||
- | |||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | * **INVENTORY_MODULE_NAME**: | ||
- | * **DATA1; | ||
- | * In the file '' | ||
- | * In order for the local script execution to store inventory information, | ||
- | * Therefore, the Inventory Module must be created in Pandora FMS **before** restarting the Pandora FMS agent. | ||
- | |||
- | * **INVENTORY_MODULE_NAME**: | ||
- | * **DATA1; | ||
- | * ファイル '' | ||
- | * ローカル スクリプト実行でインベントリ情報を保存するには、コンソールでインベントリ モジュールを定義し、オペレーティングシステム、モジュール名、および保存するデータを '' | ||
- | * したがって、Pandora FMS エージェントを再起動する **前**に、Pandora FMS でインベントリモジュールを作成する必要があります。 | ||
- | |||
- | ===== インベントリのデータ表示 ===== | ||
- | |||
- | Inventory data that has been collected from a system, whether locally or remotely, can be viewed from the Agent itself or from the Console Inventory menu. | ||
- | |||
- | ローカルまたはリモートでシステムから収集されたインベントリデータは、エージェントもしくはコンソールのインベントリメニューから参照することができます。 | ||
- | |||
- | ==== インベントリメニューでのインベントリデータ表示 ==== | ||
- | |||
- | From **Operation** → **Monitoring** → **Inventory** it is possible to view the inventory data of all agents, perform searches and export the data to a CSV file. | ||
- | |||
- | **操作(Operation)** → **モニタリング(Monitoring)** → **インベントリ(Inventory)** をクリックすることにより、エージェントのインベントリデータの参照、検索、データの CSV へのエクスポートができます。 | ||
- | |||
- | By default, all agents are shown, but it is possible to view the modules of all agents that have inventory by choosing **All** in the search options and clicking **Search**. In any search case (group, module, etc.) you can group by agent if you check the **Order by agent** option. | ||
- | |||
- | デフォルトでは、すべてのエージェントが表示されますが、検索オプションで **すべて** を選択し、**検索** をクリックすると、インベントリを持つすべてのエージェントのモジュールを表示できます。 **エージェントごとに並べる(Order by agent)** オプションをチェックすると、どの検索ケース (グループ、モジュールなど) でもエージェントごとにグループ化できます。 | ||
- | |||
- | In the detailed view of the Agent inventory, through a selector, you can choose the date of the specific inventory report to view (by default **Last**). | ||
- | |||
- | エージェントインベントリの詳細表示では、セレクターを使用して、表示する特定のインベントリレポートの日付 (デフォルトでは **最新**) を選択できます。 | ||
- | |||
- | <WRAP center round info 90%> | ||
- | |||
- | If you notice missing dates it will probably be because there are no changes in the data from the last inventory run. That is, Pandora FMS only stores inventory data when it changes compared to the last run.</ | ||
- | |||
- | <WRAP center round info 90%> | ||
- | |||
- | 日付が無い場合は、前回のインベントリ実行からデータに変更がないことが原因である可能性があります。 つまり、Pandora FMS は、インベントリデータが前回の実行と比較して変化した場合にのみ保存します。 | ||
- | </ | ||
- | |||
- | |||
- | ==== インベントリデータの CSV エクスポート ==== | ||
- | |||
- | From **Operation** → **Monitoring** → **Inventory** it is possible to export the inventory data, the result of a filter, to a CSV file using the **Export this list to CSV** button. A file with the inventory data separated by the [[: | ||
- | |||
- | **操作(Operation)** → **モニタリング(Monitoring)** → **インベントリ(Inventory)** をクリックすると、フィルタリングしたあとのインベントリデータを **この一覧を CSV へエクスポートする(Export this list to CSV)** ボタンを使って CSV ファイルへエクスポートすることができます。[[: | ||
- | |||
- | ==== インベントリ差分 ==== | ||
- | |||
- | Pandora FMS can visually show the differences between two configurations, | ||
- | |||
- | Pandora FMS は、2 つの設定間の違いを視覚的に表示し、違いを確認するために 2 つの列に表示します。 **ブロックモード**では、前に見たインベントリモジュールで行われていたように、各行を同じタイプの異なる要素として解釈するのではなく、インベントリモジュールの結果全体を一つとして処理します。 ローカルまたはリモートのインベントリ モジュールを定義するときに設定されます。 | ||
- | |||
- | {{ : | ||
- | |||
- | ===== インベントリアラート ===== | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | |||
- | Version 751 NG or later. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | |||
- | バージョン NG 751 以降 | ||
- | |||
- | </ | ||
- | |||
- | [[https:// | ||
- | |||
- | [[https:// | ||
- | |||
- | To configure alerts, you must go to the **Management** → **Alerts** → **Inventory alerts** section. | ||
- | |||
- | これを設定するには、**管理(Management)** → **アラート(Alerts)** → **インベントリアラート(Inventory alerts)** へ行きます。 | ||
- | |||
- | Inventory alerts have fields similar to [[: | ||
- | |||
- | インベントリアラートには、名前、説明、時間しきい値 、アクションなど、[[: | ||
- | |||
- | * The **group** in this case acts as the alert condition, so alerts will be evaluated for any data that comes from an Agent in said group. | ||
- | * These alerts also have the option **deactivate event** which is used so that when the alert is triggered, an alert event is not generated. It is useful since it is possible that with the application of inventory alerts many alerts are triggered in a single execution. | ||
- | |||
- | * **グループ** | ||
- | * これらのアラートには、アラートが発報されたときにアラートイベントを生成しないようにするための **イベントの無効化** | ||
- | |||
- | ==== アラート発報条件 ==== | ||
- | |||
- | |||
- | === 文字列マッチ === | ||
- | |||
- | In this way, when a specific string arrives in a specific inventory module (for example “software”) the established action will be triggered. Inventory Modules have **dynamic fields**; For example, in the software inventory module, there are the fields name, version and description that can be used. This way you can set an alert for any of the three d fields.static, | ||
- | |||
- | 特定のインベントリモジュール内の特定のテキスト文字列(" | ||
- | |||
- | In these fields you can enter regular expressions to make more complex searches. If a field is empty it counts as '' | ||
- | |||
- | これらのフィールドに正規表現を追加して、より複雑な検索を行うことができます。フィールドが空の場合、'' | ||
- | |||
- | === 制限リスト === | ||
- | |||
- | In this case (**Condition**, | ||
- | |||
- | この場合、インベントリモジュールタイプのフィールドを 1つだけ指定し、文字列リスト(1行ずつ)を指定して、エージェントにそのリストの要素が含まれている場合にアラートが発生するようにします。リストにあるものがある場合、アラートが発生します。 | ||
- | |||
- | |||
- | === 許可リスト === | ||
- | |||
- | Similar [[: | ||
- | |||
- | [[: | ||
- | |||
- | ==== インベントリアラートの利用 ==== | ||
- | |||
- | [[https:// | ||
- | |||
- | [[https:// | ||
- | |||
- | ===== セキュリティ監視 ===== | ||
- | |||
- | Pandora FMS allows you to collect, in addition to inventory data, other important values of each operating system monitored through software agents. All this is centralized in the **Operation → Security → Hardening** section. | ||
- | |||
- | Pandora FMS を使用すると、インベントリデータに加えて、ソフトウェアエージェントを通じて監視される各オペレーティングシステムのその他の重要な値を収集できます。これらすべては、**操作(Operation) → セキュリティ(Security) → 強化(Hardening)** セクションにあります。 | ||
- | |||
- | This tool seeks to strengthen the security of each of the monitored devices and the information is presented in three main sections. | ||
- | |||
- | このツールは、監視対象の各デバイスのセキュリティを強化することを目的としており、情報は 3 つの主要なセクションで表示されます。 | ||
- | |||
- | ==== 履歴概要 ==== | ||
- | |||
- | The **Historical summary** presents the total number of agents that monitor the modules intended for security and the total average score (**Total agents and scoring** table). | ||
- | |||
- | **履歴概要**には、セキュリティを目的としたモジュールを監視するエージェントの合計数と合計平均スコア (**エージェントの合計とスコア** 表) が表示されます。 | ||
- | |||
- | {{ : | ||
- | |||
- | The table **AVG Score by group** presents the average score for each group defined in PFMS. | ||
- | |||
- | **グループ別の AVG スコア** 表は、Pandora FMS で定義されている各グループの平均スコアを示しています。 | ||
- | |||
- | There is also a historical graph (**Time line** table) with the average of failed and approved security checks grouped by days (maximum the last eleven days) regardless of the selected time period. In **Filters** you can select a custom time period or common values (last week, last month, etc.). | ||
- | |||
- | 選択した期間に関係なく、失敗したセキュリティチェックと承認されたセキュリティチェックの平均を日ごとにグループ化した履歴グラフ (**タイムライン** 表) もあります (最大で過去 11 日間)。 **フィルタ** では、カスタム期間または一般的な値 (先週、先月など) を選択できます。 | ||
- | |||
- | ===== (OBSOLETE) ===== | ||
- | |||
- | === リモートインベントリモジュール例 === | ||
- | |||
- | UNIX サーバから物理アドレスの一覧を取得する必要がある場合を想定します。これは、通常 "arp -a -n" コマンドで取得でき、サーバで実行すると次のような出力を得られます。 | ||
- | < | ||
- | |||
- | artica@galaga: | ||
- | ? (192.168.70.74) at 08: | ||
- | ? (192.168.70.162) at B4: | ||
- | ? (192.168.50.30) at 08: | ||
- | ? (192.168.70.90) at 98: | ||
- | ? (192.168.50.2) at 08: | ||
- | ? (192.168.70.135) at C8: | ||
- | ? (192.168.60.182) at FE: | ||
- | |||
- | </ | ||
- | |||
- | やりたいことは、IP アドレス、MSC アドレス、ネットワークインタフェース名を抽出することです。 | ||
- | |||
- | これは、フィールドを " " | ||
- | |||
- | < | ||
- | arp -a -n | sort | grep -v incomplete | awk '{ print $2,$4,$7 }' | ||
- | |||
- | </ | ||
- | |||
- | Pandora のリモートインベントリサーバへ、この情報を " | ||
- | |||
- | ここで、若干スクリプトのプログラミングの知識が必要になります。リモートインベントリスクリプトには、複雑ではありませんが、多少 perl、シェルスクリプト、その他言語の知識が必要です。モジュールから実行され、データ単位ごとに 1行で、かつフィールドを ";" | ||
- | < | ||
- | |||
- | # | ||
- | ########################################################################## | ||
- | # pandora_linux_arptable.pl | ||
- | ########################################################################## | ||
- | # Copyright (c) 2012 Sancho Lerena < | ||
- | # (c) 2012 Artica Soluciones Tecnologicas S.L | ||
- | # | ||
- | # This program is free software; you can redistribute it and/or | ||
- | # modify it under the terms of the GNU General Public License | ||
- | # as published by the Free Software Foundation; version 2. | ||
- | # | ||
- | # This program is distributed in the hope that it will be useful, | ||
- | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
- | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
- | # GNU General Public License for more details. | ||
- | # You should have received a copy of the GNU General Public License | ||
- | # along with this program; if not, write to the Free Software | ||
- | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
- | ########################################################################## | ||
- | |||
- | use strict; | ||
- | use warnings; | ||
- | |||
- | # Check for ssh | ||
- | my $ssh_client = " | ||
- | if (system(" | ||
- | print " | ||
- | exit 1; | ||
- | } | ||
- | |||
- | if ($#ARGV <1) { | ||
- | print " | ||
- | exit 1; | ||
- | } | ||
- | |||
- | my $target_ip = $ARGV[0]; | ||
- | my $username = $ARGV[1]; | ||
- | |||
- | # Retrieve ARP table | ||
- | my ($ip, $mac, $iface); | ||
- | my $command = '/ | ||
- | |||
- | my @info = `$ssh_client $username\@$target_ip " | ||
- | foreach my $line (@info) { | ||
- | if ($line =~ / | ||
- | $ip = $1; | ||
- | $mac = $2; | ||
- | $iface = $3; | ||
- | print " | ||
- | } | ||
- | } | ||
- | |||
- | exit 0; | ||
- | |||
- | </ | ||
- | |||
- | SSH 接続を自動実行できるようにするためには、対象のサーバに pandora サーバの root ユーザの公開鍵をコピーする必要があります。このコマンドを 192.168.50.10 のサーバで実行することを想定した場合、次のようになります。 | ||
- | |||
- | 1. pandora サーバで root にて鍵を生成します。 | ||
- | < | ||
- | |||
- | ssh-keygen | ||
- | |||
- | </ | ||
- | |||
- | 2. ssh-copy-id コマンドを使って、公開鍵を対象のサーバ(192.168.50.10)の対象ユーザ(例では artica)へコピーします。 | ||
- | |||
- | < | ||
- | ssh-copy-id -i / | ||
- | |||
- | </ | ||
- | |||
- | (対象のユーザに公開鍵をインストールするために、一度 " | ||
- | |||
- | 3. 接続を試します。パスワードを聞かれずに接続できる必要があります。 | ||
- | |||
- | < | ||
- | ssh artica@192.168.50.10 | ||
- | |||
- | </ | ||
- | |||
- | 4. 処理が成功したら、インベントリモジュールが実行するのと同じ処理をコマンドラインから実行してみます。前述のスクリプト(temporal.pl)を IP アドレスとユーザをパラメータに指定して実行します。 | ||
- | |||
- | < | ||
- | perl temporal.pl 192.168.50.10 artica | ||
- | (192.168.50.1); | ||
- | (192.168.50.3); | ||
- | |||
- | </ | ||
- | |||
- | スクリプトは、リモートで /// | ||
- | |||
- | {{ : | ||
- | |||
- | これをエージェントに適用する場合は、OS が同じであるか確認することに注意が必要です。異なる OS の場合は、同一のコードは動かないため、それぞれに異なるモジュールを作成する必要があります。 | ||
- | |||
- | {{ : | ||
- | |||
- | モジュールが実行されると、次のように表示されます。 | ||
- | |||
- | {{ : | ||