Next Topic

Previous Topic

Book Contents

UNIX system support files

The system type determines which types of monitors are available to the object and how they perform the test.

Network Monitor supports all built-in Windows system types. New system types can be created using a set of configuration files located in the KNM\system folder of the KNM host machine.

Note: This topic focuses mainly on UNIX, but its instructions can be used with any system type that has shell access through SSH or telnet.

System specification

To support monitoring of a disk, CPU, swap and so on, Network Monitor log in using either SSH or telnet, runs a command on the UNIX host and parses the result. What command and how the result is parsed is described in configuration files in the KNM\system folder.

All system specifications inherit the one labeled Generic UNIX. So it is only necessary to write parsing information for those commands that are different from the ones specified in the Generic UNIX system type.

Generic UNIX system definition file


<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>