Next Topic

Previous Topic

Book Contents

UNIXシステムのサポートファイル

システムタイプによって、資産に対して利用可能なモニター、およびそのモニターによるテストの実行方法が決まります。

Network Monitorは、組み込みのWindowsシステムタイプをすべてサポートします。新しいシステムタイプを作成するには、KNMのホストマシンのKNM\systemフォルダにある構成ファイルセットを使用します。

注: このトピックでは、主にUNIXについて説明しますが、その手順はSSHまたはTelnet経由でシェルアクセスを行ういずれのシステムでも使用できます。

システムの仕様

ディスク、CPU、スワップなどのモニタリングをサポートするために、SSHまたはTelnetを使用したNetwork Monitorのログインでは、UNIXホストでコマンドが実行され、結果が解析されます。使用するコマンドおよび結果の解析方法は、KNM\systemフォルダにある構成ファイルに記述されています。

すべてのシステム仕様は、Generic UNIXラベルの仕様を継承します。そのため、記述する必要があるのは、Generic UNIXシステムタイプで指定されるコマンドとは異なるコマンドの解析情報のみです。

一般的なUNIXシステム定義ファイル


<system name="Generic UNIX" release="" author="Kaseya" type="unix" internalID="5" fileRevision="1">
  <parsing>
    <!-- disk -->
    <disk>
      <!-- enumeration of disk volumes -->
      <enumeration>
        <query>
          <command>df</command>
          <enumList startLine="2">
            <value id="diskVolume" field="1" />
          </enumList>
        </query>
        <result id="volumeID">diskVolume</result>
      </enumeration>
      <!-- monitoring disk volumes-->
      <monitoring>
        <!-- free and used disk space -->
        <diskSpace>
          <query>
            <command>df -k $volume</command>
            <value id="freeSpace" line="-1" field="-3"/>
            <value id="usedSpace" line="-1" field="-4"/>
          </query>
          <result id="freeSpace" unit="MB">freeSpace / 1024</result>
          <result id="usedSpace" unit="MB">usedSpace / 1024</result>
        </diskSpace>
      </monitoring>
    </disk>
    <!-- cpu -->
    <cpu>
      <!-- enumeration of CPU's -->
      <enumeration>
        <query>
          <command>mpstat -P ALL</command>
          <enumList startLine="5">
            <value id="cpuNumber" field="3" />
          </enumList>
        </query>
        <result id="cpuID">cpuNumber</result>
      </enumeration>
      <monitoring>
        <!-- utilization of given CPU-->
        <cpuUtilization>
          <query>
            <command>mpstat -P $cpu 2 2</command>
            <value id="userLoad" line="-1" field="-9"/>
            <value id="systemLoad" line="-1" field="-7"/>
          </query>
          <result id="cpuAverageLoad" unit="%">userLoad + systemLoad</result>
        </cpuUtilization>
        <!-- overall system CPU load, used if a CPU is not specified -->
        <cpuAverageLoad>
          <query>
            <command>vmstat 2 2</command>
            <value id="userLoad" line="-1" field="-5"/>
            <value id="systemLoad" line="-1" field="-4"/>
          </query>
          <result id="cpuAverageLoad" unit="%">userLoad + systemLoad</result>
        </cpuAverageLoad>
      </monitoring>
    </cpu>
    <!-- processes -->
    <process>
      <!-- process enumeration -->
      <enumeration>
        <query>
          <command>ps -awxu</command>
          <enumList startLine="2">
            <value id="processName" field="11" />
          </enumList>
        </query>
        <result id="processName">processName</result>
      </enumeration>
      <monitoring>
        <!-- checks if a given process is running -->
        <processRunning>
          <query>
            <command>ps -awxu</command>
            <value id="processName">
              <match type="line">$process</match>
            </value>
          </query>
          <result id="processName">processName</result>
        </processRunning>
      </monitoring>
    </process>
    <!-- swap -->
    <swap>
      <monitoring>
        <swapUtilization>
          <query>
            <command>free -m</command>
            <value id="swapUsed" line="-1" field="-3"/>
            <value id="swapFree" line="-1" field="-2"/>
          </query>
          <result id="swapFree" unit="MB">swapFree</result>
          <result id="swapUsed" unit="MB">swapUsed</result>
        </swapUtilization>
      </monitoring>
    </swap>
    <!-- memory usage -->
    <memory>
      <monitoring>
        <!-- free and used memory -->
        <freeMemory>
          <query>
            <command>free -m</command>
            <value id="freeMem" line="3" field="-1"/>
            <value id="usedMem" line="3" field="-2"/>
          </query>
          <result id="freeMemory" unit="MB">freeMem</result>
          <result id="usedMemory" unit="MB">usedMem</result>
        </freeMemory>
      </monitoring>
    </memory>
    <!-- file change -->
    <file>
      <monitoring>
        <fileChange>
          <query>
            <command>ls -l --full-time $filename</command>
            <value id="fileSize" line="1" field="5"/>
            <value id="fileDate" line="1" field="6"/>
            <value id="fileTime" line="1" field="7"/>
          </query>
          <result id="fileSize" unit="B">fileSize</result>
          <result id="fileDate">fileDate</result>
          <result id="fileTime">fileTime</result>
        </fileChange>
      </monitoring>
    </file>
  </parsing>
</system>