[deployment-guide] Updated the "System Monitoring Tools" chapter.

Jaromir Hradilek jhradile at fedoraproject.org
Wed Oct 12 15:55:15 UTC 2011


commit c3e866a6af1af120d88b656e5f9fc1f460e70925
Author: Jaromir Hradilek <jhradile at redhat.com>
Date:   Wed Oct 12 16:00:12 2011 +0200

    Updated the "System Monitoring Tools" chapter.
    
    I have also added Michael Solberg's excellent write-up about Net-SNMP.

 en-US/System_Monitoring_Tools.xml | 1241 ++++++++++++++++++++++++++++---------
 1 files changed, 956 insertions(+), 285 deletions(-)
---
diff --git a/en-US/System_Monitoring_Tools.xml b/en-US/System_Monitoring_Tools.xml
index 412e631..c4b3764 100644
--- a/en-US/System_Monitoring_Tools.xml
+++ b/en-US/System_Monitoring_Tools.xml
@@ -3,98 +3,93 @@
 ]>
 <chapter id="ch-System_Monitoring_Tools">
   <title>System Monitoring Tools</title>
-  <indexterm
-    significance="normal">
+  <indexterm>
     <primary>system information</primary>
     <secondary>gathering</secondary>
   </indexterm>
-  <indexterm
-    significance="normal">
+  <indexterm>
     <primary>information</primary>
     <secondary>about your system</secondary>
   </indexterm>
-  <para>Before you learn how to configure your system, you should learn how to gather essential system information. For example, you should know how to find the amount of free memory, the amount of available hard drive space, how your hard drive is partitioned, and what processes are running. This chapter discusses how to retrieve this type of information from your &MAJOROS; system using simple commands and a few simple programs.</para>
-  <section
-    id="s1-sysinfo-system-processes">
-    <title>System Processes</title>
-    <indexterm
-      significance="normal">
+  <para>
+    Before you learn how to configure your system, you should learn how to gather essential system information. For example, you should know how to find the amount of free memory, the amount of available hard drive space, how your hard drive is partitioned, and what processes are running. This chapter discusses how to retrieve this type of information from your &MAJOROS; system using simple commands and a few simple programs.
+  </para>
+  <section id="s1-sysinfo-system-processes">
+    <title>Viewing System Processes</title>
+    <indexterm>
       <primary>system information</primary>
       <secondary>processes</secondary>
     </indexterm>
-    <indexterm
-      significance="normal">
+    <indexterm>
       <primary>processes</primary>
     </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>ps</command>
-      </primary>
+    <indexterm>
+      <primary><command>ps</command></primary>
     </indexterm>
-    <para>The <command>ps ax</command> command displays a list of current system processes, including processes owned by other users. To display the owner alongside each process, use the <command>ps aux</command> command. This list is a static list; in other words, it is a snapshot of what was running when you invoked the command. If you want a constantly updated list of running processes, use <command>top</command> as described below.</para>
-    <para>The <command>ps</command> output can be long. To prevent it from scrolling off the screen, you can pipe it through less:</para>
-    <screen><command>ps aux | less</command></screen>
-    <para>You can use the <command>ps</command> command in combination with the <command>grep</command> command to see if a process is running. For example, to determine if <application>Emacs</application> is running, use the following command:</para>
-    <screen><command>ps ax | grep emacs</command></screen>
-    <indexterm
-      significance="normal">
+    <para>
+      The <command>ps ax</command> command displays a list of current system processes, including processes owned by other users. To display the owner alongside each process, use the <command>ps aux</command> command. This list is a static list; in other words, it is a snapshot of what was running when you invoked the command. If you want a constantly updated list of running processes, use <command>top</command> as described below.
+    </para>
+    <para>
+      The <command>ps</command> output can be long. To prevent it from scrolling off the screen, you can pipe it through less:
+    </para>
+    <synopsis><command>ps</command> <option>aux</option> | <command>less</command></synopsis>
+    <para>
+      You can use the <command>ps</command> command in combination with the <command>grep</command> command to see if a process is running. For example, to determine if <application>Emacs</application> is running, use the following command:
+    </para>
+    <synopsis><command>ps</command> <option>ax</option> | <command>grep</command> <option>emacs</option></synopsis>
+    <indexterm>
       <primary>system information</primary>
       <secondary>processes</secondary>
       <tertiary>currently running</tertiary>
     </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>top</command>
-      </primary>
+    <indexterm>
+      <primary><command>top</command></primary>
     </indexterm>
-    <para>The <command>top</command> command displays currently running processes and important information about them including their memory and CPU usage. The list is both real-time and interactive. An example of output from the <command>top</command> command is provided as follows:</para>
-    <screen>top - 18:11:48 up 1 min,  1 user,  load average: 0.68, 0.30, 0.11
+    <para>
+      The <command>top</command> command displays currently running processes and important information about them including their memory and CPU usage. The list is both real-time and interactive. An example of output from the <command>top</command> command is provided as follows:
+    </para>
+    <screen>~]$ <command>top</command>
+top - 18:11:48 up 1 min,  1 user,  load average: 0.68, 0.30, 0.11
 Tasks: 122 total,   1 running, 121 sleeping,   0 stopped,   0 zombie
 Cpu(s):  0.0%us,  0.5%sy,  0.0%ni, 93.4%id,  5.7%wa,  0.2%hi,  0.2%si,  0.0
 Mem:    501924k total,   376496k used,   125428k free,    29664k buffers
 Swap:  1015800k total,        0k used,  1015800k free,   189008k cached
 
-  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND       
+  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  1601 root      40   0 20172 1084  920 S  0.3  0.2   0:00.08 hald-addon-sto
- 1998 silas     40   0 14984 1160  880 R  0.3  0.2   0:00.13 top           
-    1 root      40   0 19160 1412 1156 S  0.0  0.3   0:00.96 init          
-    2 root      40   0     0    0    0 S  0.0  0.0   0:00.01 kthreadd      
-    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.05 migration/0   
-    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0   
-    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0    
-    6 root      RT   0     0    0    0 S  0.0  0.0   0:00.04 migration/1   
-    7 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/1   
-    8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/1    
-    9 root      20   0     0    0    0 S  0.0  0.0   0:00.00 events/0      
-   10 root      20   0     0    0    0 S  0.0  0.0   0:00.01 events/1      
-   11 root      20   0     0    0    0 S  0.0  0.0   0:00.00 cpuset        
-   12 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper       
+ 1998 silas     40   0 14984 1160  880 R  0.3  0.2   0:00.13 top
+    1 root      40   0 19160 1412 1156 S  0.0  0.3   0:00.96 init
+    2 root      40   0     0    0    0 S  0.0  0.0   0:00.01 kthreadd
+    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.05 migration/0
+    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
+    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
+    6 root      RT   0     0    0    0 S  0.0  0.0   0:00.04 migration/1
+    7 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/1
+    8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/1
+    9 root      20   0     0    0    0 S  0.0  0.0   0:00.00 events/0
+   10 root      20   0     0    0    0 S  0.0  0.0   0:00.01 events/1
+   11 root      20   0     0    0    0 S  0.0  0.0   0:00.00 cpuset
+   12 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper
 <lineannotation>[output truncated]</lineannotation></screen>
-    <para>To exit <command>top</command>, press the <keycap>q</keycap> key.</para>
     <para>
-      <xref
-        linkend="interactive-top-command"/> contains useful interactive commands that you can use with <command>top</command>. For more information, refer to the <command>top</command>(1) manual page.</para>
-    <table
-      id="interactive-top-command">
+      To exit <command>top</command>, press the <keycap>q</keycap> key.
+    </para>
+    <para>
+      <xref linkend="interactive-top-command" /> contains useful interactive commands that you can use with <command>top</command>. For more information, refer to the <command>top</command>(1) manual page.
+    </para>
+    <table id="interactive-top-command">
       <title>Interactive top commands</title>
-      <tgroup
-        cols="2">
-        <colspec
-          colname="command"
-          colnum="1"/>
-        <colspec
-          colname="description"
-          colnum="2"/>
+      <tgroup cols="2">
+        <colspec colname="command" colnum="1" colwidth="25*" />
+        <colspec colname="description" colnum="2" colwidth="75*" />
         <thead>
           <row>
             <entry>
-							Command
-						</entry>
+              Command
+            </entry>
             <entry>
-							Description
-						</entry>
+              Description
+            </entry>
           </row>
         </thead>
         <tbody>
@@ -103,114 +98,140 @@ Swap:  1015800k total,        0k used,  1015800k free,   189008k cached
               <keycap>Space</keycap>
             </entry>
             <entry>
-							Immediately refresh the display
-						</entry>
+              Immediately refresh the display
+            </entry>
           </row>
           <row>
             <entry>
               <keycap>h</keycap>
             </entry>
             <entry>
-							Display a help screen
-						</entry>
+              Display a help screen
+            </entry>
           </row>
           <row>
             <entry>
               <keycap>k</keycap>
             </entry>
             <entry>
-							Kill a process. You are prompted for the process ID and the signal to send to it.
-						</entry>
+              Kill a process. You are prompted for the process ID and the signal to send to it.
+            </entry>
           </row>
           <row>
             <entry>
               <keycap>n</keycap>
             </entry>
             <entry>
-							Change the number of processes displayed. You are prompted to enter the number.
-						</entry>
+              Change the number of processes displayed. You are prompted to enter the number.
+            </entry>
           </row>
           <row>
             <entry>
               <keycap>u</keycap>
             </entry>
             <entry>
-							Sort by user.
-						</entry>
+              Sort by user.
+            </entry>
           </row>
           <row>
             <entry>
               <keycap>M</keycap>
             </entry>
             <entry>
-							Sort by memory usage.
-						</entry>
+              Sort by memory usage.
+            </entry>
           </row>
           <row>
             <entry>
               <keycap>P</keycap>
             </entry>
             <entry>
-							Sort by CPU usage.
-						</entry>
+              Sort by CPU usage.
+            </entry>
           </row>
         </tbody>
       </tgroup>
     </table>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>gnome-system-monitor</command>
-      </primary>
+    <indexterm>
+      <primary><command>gnome-system-monitor</command></primary>
     </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <application>GNOME System Monitor</application>
-      </primary>
+    <indexterm>
+      <primary><application>GNOME System Monitor</application></primary>
     </indexterm>
-    <para>If you prefer a graphical interface for <command>top</command>, you can use the <application>GNOME System Monitor</application>. To start it from the desktop, select <menuchoice><guimenu>Applications</guimenu><guisubmenu>System Tools</guisubmenu><guimenuitem>System Monitor</guimenuitem></menuchoice> from the <guimenu>Activities</guimenu> menu, or execute <command>gnome-system-monitor</command> at a shell prompt. Select the <guilabel>Processes</guilabel> tab.</para>
-    <para>The <application>GNOME System Monitor</application> allows you to search for a process in the list of running processes. Using the <application>GNOME System Monitor</application>, you can also view all processes, your processes, or active processes.</para>
-    <para>The <guimenuitem>Edit</guimenuitem> menu item allows you to:</para>
+    <para>
+      If you prefer a graphical interface for <command>top</command>, you can use the <application>GNOME System Monitor</application>. To start it from the desktop, select <menuchoice><guimenu>Applications</guimenu><guimenuitem>System Tools</guimenuitem><guimenuitem>System Monitor</guimenuitem></menuchoice> or execute <command>gnome-system-monitor</command> at a shell prompt. Select the <guilabel>Processes</guilabel> tab.
+    </para>
+    <para>
+      The <application>GNOME System Monitor</application> allows you to search for a process in the list of running processes. Using the <application>GNOME System Monitor</application>, you can also view all processes, your processes, or active processes.
+    </para>
+    <para>
+      The <guimenuitem>Edit</guimenuitem> menu item allows you to:
+    </para>
     <itemizedlist>
       <listitem>
-        <para>Stop a process.</para>
+        <para>
+          Stop a process.
+        </para>
       </listitem>
       <listitem>
-        <para>Continue or start a process.</para>
+        <para>
+          Continue or start a process.
+        </para>
       </listitem>
       <listitem>
-        <para>End a processes.</para>
+        <para>
+          End a processes.
+        </para>
       </listitem>
       <listitem>
-        <para>Kill a process.</para>
+        <para>
+          Kill a process.
+        </para>
       </listitem>
       <listitem>
-        <para>Change the priority of a selected process.</para>
+        <para>
+          Change the priority of a selected process.
+        </para>
       </listitem>
       <listitem>
-        <para>Edit the System Monitor preferences. These include changing the interval seconds to refresh the list and selecting process fields to display in the System Monitor window.</para>
+        <para>
+          Edit the System Monitor preferences. These include changing the interval seconds to refresh the list and selecting process fields to display in the System Monitor window.
+        </para>
       </listitem>
     </itemizedlist>
-    <para>The <guimenuitem>View</guimenuitem> menu item allows you to:</para>
+    <para>
+      The <guimenuitem>View</guimenuitem> menu item allows you to:
+    </para>
     <itemizedlist>
       <listitem>
-        <para>View only active processes.</para>
+        <para>
+          View only active processes.
+        </para>
       </listitem>
       <listitem>
-        <para>View all processes.</para>
+        <para>
+          View all processes.
+        </para>
       </listitem>
       <listitem>
-        <para>View my processes.</para>
+        <para>
+          View my processes.
+        </para>
       </listitem>
       <listitem>
-        <para>View process dependencies.</para>
+        <para>
+          View process dependencies.
+        </para>
       </listitem>
       <listitem>
-        <para>View a memory map of a selected process.</para>
+        <para>
+          View a memory map of a selected process.
+        </para>
       </listitem>
       <listitem>
-        <para>View the files opened by the selected process.</para>
+        <para>
+          View the files opened by the selected process.
+        </para>
       </listitem>
       <listitem>
         <para>
@@ -218,274 +239,924 @@ Swap:  1015800k total,        0k used,  1015800k free,   189008k cached
         </para>
       </listitem>
     </itemizedlist>
-    <para>To stop a process, select it and click <guibutton>End Process</guibutton>. Alternatively you can also stop a process by selecting it, clicking <guimenuitem>Edit</guimenuitem> on your menu and selecting <guimenuitem>Stop Process</guimenuitem>.</para>
-    <para>To sort the information by a specific column, click on the name of the column. This sorts the information by the selected column in ascending order. Click on the name of the column again to toggle the sort between ascending and descending order.</para>
+    <para>
+      To stop a process, select it and click <guibutton>End Process</guibutton>. Alternatively you can also stop a process by selecting it, clicking <guimenuitem>Edit</guimenuitem> on your menu and selecting <guimenuitem>Stop Process</guimenuitem>.
+    </para>
+    <para>
+      To sort the information by a specific column, click on the name of the column. This sorts the information by the selected column in ascending order. Click on the name of the column again to toggle the sort between ascending and descending order.
+    </para>
     <figure id="fig-sysinfo-processes">
-      <title>
-        GNOME System Monitor — Processes tab
-      </title>
+      <title>GNOME System Monitor - Processes tab</title>
       <mediaobject>
         <imageobject>
-          <imagedata fileref="images/system-monitor-processes.png" format="PNG" scalefit="0" />
+          <imagedata fileref="images/gnome-system-monitor-processes.png" format="PNG" scalefit="0" />
         </imageobject>
         <textobject>
-          <para>Processes tab of the GNOME System Monitor</para>
+          <para>
+            Processes tab of the gnome-system-monitor
+          </para>
         </textobject>
       </mediaobject>
     </figure>
   </section>
-  <section
-    id="s1-sysinfo-memory-usage">
-    <title>Memory Usage</title>
-    <indexterm
-      significance="normal">
+  <section id="s1-sysinfo-memory-usage">
+    <title>Viewing Memory Usage</title>
+    <indexterm>
       <primary>system information</primary>
       <secondary>memory usage</secondary>
     </indexterm>
-    <indexterm
-      significance="normal">
+    <indexterm>
       <primary>memory usage</primary>
     </indexterm>
-    <indexterm
-      significance="normal">
+    <indexterm>
       <primary>RAM</primary>
     </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>free</command>
-      </primary>
+    <indexterm>
+      <primary><command>free</command></primary>
     </indexterm>
-    <para>The <command>free</command> command displays the total amount of physical memory and swap space for the system as well as the amount of memory that is used, free, shared, in kernel buffers, and cached.</para>
-    <screen>             total       used       free     shared    buffers     cached
+    <para>
+      The <command>free</command> command displays the total amount of physical memory and swap space for the system as well as the amount of memory that is used, free, shared, in kernel buffers, and cached.
+    </para>
+<screen>~]$ <command>free</command>
+             total       used       free     shared    buffers     cached
 Mem:       4017660    1619044    2398616          0      59864     637968
 -/+ buffers/cache:     921212    3096448
 Swap:      3071996          0    3071996</screen>
-    <para>The command <command>free -m</command> shows the same information in megabytes, which are easier to read.</para>
-    <screen>             total       used       free     shared    buffers     cached
+    <para>
+      The command <command>free -m</command> shows the same information in megabytes, which are easier to read.
+    </para>
+<screen>~]$ <command>free -m</command>
+             total       used       free     shared    buffers     cached
 Mem:          3923       1569       2353          0         58        626
 -/+ buffers/cache:        884       3038
 Swap:         2999          0       2999</screen>
-    <para>If you prefer a graphical interface for <command>free</command>, you can use the <application>GNOME System Monitor</application>. To start it from the desktop, select <menuchoice><guimenu>Applications</guimenu><guisubmenu>System Tools</guisubmenu><guimenuitem>System Monitor</guimenuitem></menuchoice> from the <guimenu>Activities</guimenu> menu, or execute <command>gnome-system-monitor</command> at a shell prompt. Click on the <guilabel>Resources</guilabel> tab.</para>
+    <para>
+      If you prefer a graphical interface for <command>free</command>, you can use the <application>GNOME System Monitor</application>. To start it from the desktop, select <menuchoice><guimenu>Applications</guimenu><guimenuitem>System Tools</guimenuitem><guimenuitem>System Monitor</guimenuitem></menuchoice> or execute <command>gnome-system-monitor</command> at a shell prompt. Click on the <guilabel>Resources</guilabel> tab.
+    </para>
     <figure id="fig-sysinfo-memory">
-      <title>
-        GNOME System Monitor — Resources tab
-      </title>
+      <title>GNOME System Monitor - Resources tab</title>
       <mediaobject>
         <imageobject>
-          <imagedata fileref="images/system-monitor-resources.png" format="PNG" scalefit="0" />
+          <imagedata fileref="images/gnome-system-monitor-memory.png" format="PNG" scalefit="0" />
         </imageobject>
         <textobject>
-          <para>Resources tab of the GNOME System Monitor</para>
+          <para>
+            Resources tab of the gnome-system-monitor
+          </para>
         </textobject>
       </mediaobject>
     </figure>
   </section>
-  <section
-    id="s1-sysinfo-filesystems">
-    <title>File Systems</title>
-    <indexterm
-      significance="normal">
+  <section id="s1-sysinfo-filesystems">
+    <title>Viewing File Systems</title>
+    <indexterm>
       <primary>system information</primary>
       <secondary>file systems</secondary>
     </indexterm>
-    <indexterm
-      significance="normal">
+    <indexterm>
       <primary>file systems</primary>
     </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>df</command>
-      </primary>
+    <indexterm>
+      <primary><command>df</command></primary>
     </indexterm>
-    <para>The <command>df</command> command reports the system's disk space usage. If you Execute the command <command>df</command> at a shell prompt, the output looks similar to the following:</para>
-    <screen>Filesystem           1K-blocks      Used Available Use% Mounted on
-rootfs                 6726160   3091216   3566620  47% /
-udev                    500716         0    500716   0% /dev
-tmpfs                   507840      2152    505688   1% /dev/shm
-tmpfs                   507840       644    507196   1% /run
-/dev/sda1              6726160   3091216   3566620  47% /
-tmpfs                   507840         0    507840   0% /sys/fs/cgroup
-tmpfs                   507840         0    507840   0% /media
-/dev/sda4            139412616 105018908  27367684  80% /home
-/dev/sda1              6726160   3091216   3566620  47% /tmp
-/dev/sda1              6726160   3091216   3566620  47% /var/tmp</screen>
-    <para>By default, this utility shows the partition size in 1 kilobyte blocks and the amount of used and available disk space in kilobytes. To view the information in megabytes and gigabytes, use the command <command>df -h</command>. The <command>-h</command> argument stands for human-readable format. The output looks similar to the following:</para>
-    <screen>Filesystem            Size  Used Avail Use% Mounted on
-rootfs                6.5G  3.0G  3.5G  47% /
-udev                  489M     0  489M   0% /dev
-tmpfs                 496M  2.2M  494M   1% /dev/shm
-tmpfs                 496M  644K  496M   1% /run
-/dev/sda1             6.5G  3.0G  3.5G  47% /
-tmpfs                 496M     0  496M   0% /sys/fs/cgroup
-tmpfs                 496M     0  496M   0% /media
-/dev/sda4             133G  101G   27G  80% /home
-/dev/sda1             6.5G  3.0G  3.5G  47% /tmp
-/dev/sda1             6.5G  3.0G  3.5G  47% /var/tmp</screen>
-    <indexterm
-      significance="normal">
+    <para>
+      The <command>df</command> command reports the system's disk space usage. If you Execute the command <command>df</command> at a shell prompt, the output looks similar to the following:
+    </para>
+    <screen>~]$ <command>df</command>
+Filesystem           1K-blocks      Used Available Use% Mounted on
+/dev/mapper/volgrp1-lvroot
+                      14127024   6868092   6541316  52% /
+tmpfs                  2008828       592   2008236   1% /dev/shm
+/dev/sda1               495844     65047    405197  14% /boot
+/dev/mapper/luks-b20f8f7a-7f0f-4497-8de4-81bfa3e541cf
+                     122046576  12111420 103735552  11% /home</screen>
+    <para>
+      By default, this utility shows the partition size in 1 kilobyte blocks and the amount of used and available disk space in kilobytes. To view the information in megabytes and gigabytes, use the command <command>df -h</command>. The <command>-h</command> argument stands for human-readable format. The output looks similar to the following:
+    </para>
+    <screen>~]$ <command>df -h</command>
+Filesystem            Size  Used Avail Use% Mounted on
+/dev/mapper/volgrp1-lvroot
+                       14G  6.6G  6.3G  52% /
+tmpfs                 2.0G  592K  2.0G   1% /dev/shm
+/dev/sda1             485M   64M  396M  14% /boot
+/dev/mapper/luks-b20f8f7a-7f0f-4497-8de4-81bfa3e541cf
+                      117G   12G   99G  11% /home</screen>
+    <indexterm>
       <primary>system information</primary>
       <secondary>file systems</secondary>
-      <tertiary>
-        <filename>/dev/shm</filename>
-      </tertiary>
+      <tertiary><filename>/dev/shm</filename></tertiary>
     </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <filename>/dev/shm</filename>
-      </primary>
+    <indexterm>
+      <primary><filename>/dev/shm</filename></primary>
     </indexterm>
-    <para>In the list of mounted partitions, there is an entry for <filename>/dev/shm</filename>. This entry represents the system's virtual memory file system.</para>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>du</command>
-      </primary>
+    <para>
+      In the list of mounted partitions, there is an entry for <filename>/dev/shm</filename>. This entry represents the system's virtual memory file system.
+    </para>
+    <indexterm>
+      <primary><command>du</command></primary>
     </indexterm>
-    <para>The <command>du</command> command displays the estimated amount of space being used by files in a directory. If you execute <command>du</command> at a shell prompt, the disk usage for each of the subdirectories is displayed in a list. The grand total for the current directory and subdirectories are also shown as the last line in the list. If you do not want to see the totals for all the subdirectories, use the command <command>du -hs</command> to see only the grand total for the directory in human-readable format. Use the <command>du --help</command> command to see more options.</para>
-    <para>To view the system's partitions and disk space usage in a graphical format, use the <guilabel>GNOME System Monitor</guilabel> by selecting <menuchoice><guimenu>Applications</guimenu><guisubmenu>System Tools</guisubmenu><guimenuitem>System Monitor</guimenuitem></menuchoice> from the <guimenu>Activities</guimenu> menu, or executing the <command>gnome-system-monitor</command> command at a shell prompt. Select the <guilabel>File Systems</guilabel> tab to view the system's partitions.</para>
+    <para>
+      The <command>du</command> command displays the estimated amount of space being used by files in a directory. If you execute <command>du</command> at a shell prompt, the disk usage for each of the subdirectories is displayed in a list. The grand total for the current directory and subdirectories are also shown as the last line in the list. If you do not want to see the totals for all the subdirectories, use the command <command>du -hs</command> to see only the grand total for the directory in human-readable format. Use the <command>du --help</command> command to see more options.
+    </para>
+    <para>
+      To view the system's partitions and disk space usage in a graphical format, use the <guilabel>Gnome System Monitor</guilabel> by clicking on <menuchoice><guimenu>Applications</guimenu><guimenuitem>System Tools</guimenuitem><guimenuitem>System Monitor</guimenuitem></menuchoice> or executing the <command>gnome-system-monitor</command> command at a shell prompt. Select the File Systems tab to view the system's partitions. The figure below illustrates the File Systems tab.
+    </para>
     <figure id="fig-sysinfo-filesystems">
-      <title>
-        GNOME System Monitor — File Systems tab
-      </title>
+      <title>GNOME System Monitor - File Systems tab</title>
       <mediaobject>
         <imageobject>
-          <imagedata fileref="images/system-monitor-file-systems.png" format="PNG" scalefit="0" />
+          <imagedata fileref="images/gnome-system-monitor-filesystems.png" format="PNG" scalefit="0" />
         </imageobject>
         <textobject>
-          <para>File Systems tab of the GNOME System Monitor</para>
+          <para>
+            File systems tab of the gnome-system-monitor
+          </para>
         </textobject>
       </mediaobject>
     </figure>
   </section>
-  <section
-    id="s1-sysinfo-hardware">
-    <title>Hardware</title>
-    <indexterm
-      significance="normal">
+  <section id="s1-sysinfo-hardware">
+    <title>Viewing Hardware Information</title>
+    <indexterm>
       <primary>system information</primary>
       <secondary>hardware</secondary>
     </indexterm>
-    <indexterm
-      significance="normal">
+    <indexterm>
       <primary>hardware</primary>
       <secondary>viewing</secondary>
     </indexterm>
-    <!-- jhradile: This package is no longer present in Fedora 15.
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>hwbrowser</command>
-      </primary>
-    </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>
-        <application>Hardware Browser</application>
-      </primary>
-    </indexterm>
-    <para>If you are having trouble configuring your hardware or just want to know what hardware is in your system, you can use the <application>Hardware Browser</application> application to display the hardware that can be probed. To start the program from the desktop, select <guimenu>System</guimenu> (the main menu on the panel) &gt; <guimenuitem>Administration</guimenuitem> &gt; <guimenuitem>Hardware</guimenuitem> or type <command>hwbrowser</command> at a shell prompt. As shown in <xref
-        linkend="sysinfo-hwbrowser-fig"/>, it displays your CD-ROM devices, diskette drives, hard drives and their partitions, network devices, pointing devices, system devices, and video cards. Click on the category name in the left menu, and the information is displayed.</para>
-    <figure
-      float="0"
-      id="sysinfo-hwbrowser-fig">
-      <title>
-        Hardware Browser
-      </title>
-      <mediaobject>
-        <imageobject>
-          <imagedata
-            fileref="images/hwbrowser.png"
-            format="PNG"
-            align="center"/>
-        </imageobject>
-        <textobject>
-          <para>hwbrowser</para>
-        </textobject>
-      </mediaobject>
-    </figure>
-    <indexterm
-      significance="normal">
-      <primary>
-        <command>lspci</command>
-      </primary>
-    </indexterm>
-    <indexterm
-      significance="normal">
-      <primary>PCI devices</primary>
-      <secondary>listing</secondary>
-    </indexterm>
-    <para>The <application>Device Manager</application> application can also be used to display your system hardware. This application can be started by selecting <guimenu>System</guimenu> (the main menu on the panel) &gt; <guimenuitem>Administration</guimenuitem> &gt; <guimenuitem>Hardware</guimenuitem> like the <application>Hardware Browser</application>. To start the application from a command line, type <command>hal-device-manager</command>. Depending on your installation preferences, the graphical menu above may start this application or the <application>Hardware Browser</application> when clicked. The figure below illustrates the <application>Device Manager</application> window.</para>
-    <figure
-      float="0"
-      id="sysinfo-devicemngr-fig">
-      <title>
-        Device Manager
-      </title>
-      <mediaobject>
-        <imageobject>
-          <imagedata
-            fileref="images/devicemngr.png"
-            format="PNG"
-            align="center"/>
-        </imageobject>
-        <textobject>
-          <para>Device Manager</para>
-        </textobject>
-      </mediaobject>
-    </figure>
-    -->
-    <para>If you are having trouble configuring your hardware or just want to know what hardware is in your system, you can use the <command>lspci</command> command to list all PCI devices. Use the command <command>lspci -v</command> for more verbose information or <command>lspci -vv</command> for very verbose output.</para>
-    <para>For example, <command>lspci</command> can be used to determine the manufacturer, model, and memory size of a system's video card:</para>
-    <screen>00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
+    <para>
+      You can use the <command>lspci</command> command to list all PCI devices. Use the command <command>lspci -v</command> for more verbose information or <command>lspci -vv</command> for very verbose output.
+    </para>
+    <para>
+      For example, <command>lspci</command> can be used to determine the manufacturer, model, and memory size of a system's video card:
+    </para>
+    <screen>~]$ <command>lspci -v</command>
+<lineannotation>[output truncated]</lineannotation>
+
+00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
         Subsystem: Lenovo Device 20e4
         Flags: bus master, fast devsel, latency 0
         Memory at f4200000 (64-bit, non-prefetchable) [size=1M]
-        Capabilities: [d0] Power Management version 3</screen>
-    <para>The <command>lspci</command> is also useful to determine the network card in your system if you do not know the manufacturer or model number.</para>
+        Capabilities: [d0] Power Management version 3
+
+<lineannotation>[output truncated]</lineannotation></screen>
+    <para>
+      The <command>lspci</command> is also useful to determine the network card in your system if you do not know the manufacturer or model number.
+    </para>
   </section>
-  <section
-    id="s1-sysinfo-additional-resources">
+  <section id="sect-System_Monitoring_Tools-Net-SNMP">
+    <title>Monitoring Performance with Net-SNMP</title>
+    <para>
+      &MAJOROSVER; includes the <application>Net-SNMP</application> software suite, which includes a flexible and extensible <firstterm>Simple Network Management Protocol</firstterm> (<acronym>SNMP</acronym>) agent. This agent and its associated utilities can be used to provide performance data from a large number of systems to a variety of tools which support polling over the SNMP protocol.
+    </para>
+    <para>
+      This section provides information on configuring the Net-SNMP agent to securely provide performance data over the network, retrieving the data using the SNMP protocol, and extending the SNMP agent to provide custom performance metrics.
+    </para>
+    <section id="sect-System_Monitoring_Tools-Net-SNMP-Installing">
+      <title>Installing Net-SNMP</title>
+      <para>
+        The Net-SNMP software suite is available as a set of RPM packages in the &MAJOROS; software distribution. <xref linkend="tabl-System_Monitoring_Tools-Net-SNMP-Packages" /> summarizes each of the packages and their contents.
+      </para>
+      <table id="tabl-System_Monitoring_Tools-Net-SNMP-Packages">
+        <title>Available Net-SNMP packages</title>
+        <tgroup cols="2">
+          <colspec colname="Package" colnum="1" colwidth="25*" />
+          <colspec colname="Provides" colnum="2" colwidth="75*" />
+          <thead>
+            <row>
+              <entry>
+                Package
+              </entry>
+              <entry>
+                Provides
+              </entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry>
+                <package>net-snmp</package>
+              </entry>
+              <entry>
+                The SNMP Agent Daemon and documentation. This package is required for exporting performance data.
+              </entry>
+            </row>
+            <row>
+              <entry>
+                <package>net-snmp-libs</package>
+              </entry>
+              <entry>
+                The <filename class="libraryfile">netsnmp</filename> library and the bundled management information bases (MIBs). This package is required for exporting performance data.
+              </entry>
+            </row>
+            <row>
+              <entry>
+                <package>net-snmp-utils</package>
+              </entry>
+              <entry>
+                SNMP clients such as <command>snmpget</command> and <command>snmpwalk</command>. This package is required in order to query a system's performance data over SNMP.
+              </entry>
+            </row>
+            <row>
+              <entry>
+                <package>net-snmp-perl</package>
+              </entry>
+              <entry>
+                The <command>mib2c</command> utility and the <filename>NetSNMP</filename> Perl module.
+              </entry>
+            </row>
+            <row>
+              <entry>
+                <package>net-snmp-python</package>
+              </entry>
+              <entry>
+                An SNMP client library for Python.
+              </entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+      <para>
+        To install any of these packages, use the <command>yum</command> command in the following form:
+      </para>
+      <synopsis><command>yum</command> <option>install</option> <replaceable>package</replaceable>&#8230;</synopsis>
+      <para>
+        For example, to install the SNMP Agent Daemon and SNMP clients used in the rest of this section, type the following at a shell prompt:
+      </para>
+      <screen>~]# <command>yum install net-snmp net-snmp-libs net-snmp-utils</command></screen>
+      <para>
+        Note that you must have superuser privileges (that is, you must be logged in as <systemitem class="username">root</systemitem>) to run this command. For more information on how to install new packages in &MAJOROS;, refer to <xref linkend="sec-Installing" />.
+      </para>
+    </section>
+    <section id="sect-System_Monitoring_Tools-Net-SNMP-Running">
+      <title>Running the Net-SNMP Daemon</title>
+      <para>
+        The <package>net-snmp</package> package contains <systemitem class="service">snmpd</systemitem>, the SNMP Agent Daemon. This section provides information on how to start, stop, and restart the <systemitem class="service">snmpd</systemitem> service, and shows how to enable it in a particular runlevel. For more information on the concept of runlevels and how to manage system services in Red Hat Enterprise Linux in general, refer to <xref linkend="ch-Services_and_Daemons" />.
+      </para>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Running-Starting">
+        <title>Starting the Service</title>
+        <para>
+          To run the <systemitem class="service">snmpd</systemitem> service in the current session, type the following at a shell prompt as <systemitem class="username">root</systemitem>:
+        </para>
+        <synopsis><command>service</command> <option>snmpd</option> <option>start</option></synopsis>
+        <para>
+          To configure the service to be automatically started at boot time, use the following command:
+        </para>
+        <synopsis><command>chkconfig</command> <option>snmpd</option> <option>on</option></synopsis>
+        <para>
+          This will enable the service in runlevel 2, 3, 4, and 5. Alternatively, you can use the <application>Service Configuration</application> utility as described in <xref linkend="s3-services-serviceconf-enabling" />.
+        </para>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Running-Stopping">
+        <title>Stopping the Service</title>
+        <para>
+          To stop the running <systemitem class="service">snmpd</systemitem> service, type the following at a shell prompt as <systemitem class="username">root</systemitem>:
+        </para>
+        <synopsis><command>service</command> <option>snmpd</option> <option>stop</option></synopsis>
+        <para>
+          To disable starting the service at boot time, use the following command:
+        </para>
+        <synopsis><command>chkconfig</command> <option>snmpd</option> <option>off</option></synopsis>
+        <para>
+          This will disable the service in all runlevels. Alternatively, you can use the <application>Service Configuration</application> utility as described in <xref linkend="s3-services-serviceconf-disabling" />.
+        </para>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Running-Restarting">
+        <title>Restarting the Service</title>
+        <para>
+          To restart the running <systemitem class="service">snmpd</systemitem> service, type the following at a shell prompt:
+        </para>
+        <synopsis><command>service</command> <option>snmpd</option> <option>restart</option></synopsis>
+        <para>
+          This will stop the service and start it again in quick succession. To only reload the configuration without stopping the service, run the following command instead:
+        </para>
+        <synopsis><command>service</command> <option>snmpd</option> <option>reload</option></synopsis>
+        <para>
+          This will cause the running <systemitem class="service">snmpd</systemitem> service to reload the configuration.
+        </para>
+        <para>
+          Alternatively, you can use the <application>Service Configuration</application> utility as described in <xref linkend="s3-services-serviceconf-restarting" />.
+        </para>
+      </section>
+    </section>
+    <section id="sect-System_Monitoring_Tools-Net-SNMP-Configuring">
+      <title>Configuring Net-SNMP</title>
+      <para>
+        To change the Net-SNMP Agent Daemon configuration, edit the <filename>/etc/snmp/snmpd.conf</filename> configuration file. The default <filename>snmpd.conf</filename> file shipped with &MAJOROSVER; is heavily commented and serves as a good starting point for agent configuration.
+      </para>
+      <para>
+        This section focuses on two common tasks: setting system information and configuring authentication. For more information about available configuration directives, refer to the <emphasis role="bold">snmpd.conf</emphasis>(5) manual page. Additionally, there is a utility in the <package>net-snmp</package> package named <command>snmpconf</command> which can be used to interactively generate a valid agent configuration.
+      </para>
+      <para>
+        Note that the <package>net-snmp-utils</package> package must be installed in order to use the <command>snmpwalk</command> utility described in this section.
+      </para>
+      <note>
+        <title>Applying the changes</title>
+        <para>
+          For any changes to the configuration file to take effect, force the <systemitem class="service">snmpd</systemitem> service to re-read the configuration by running the following command as <systemitem class="username">root</systemitem>:
+        </para>
+        <synopsis><command>service</command> <option>snmpd</option> <option>reload</option></synopsis>
+      </note>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Configuring-System_Information">
+        <title>Setting System Information</title>
+        <para>
+          Net-SNMP provides some rudimentary system information via the <systemitem>system</systemitem> tree. For example, the following <command>snmpwalk</command> command shows the <systemitem>system</systemitem> tree with a default agent configuration.
+        </para>
+        <screen>~]# <command>snmpwalk -v2c -c public localhost system</command>
+SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
+SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
+DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (99554) 0:16:35.54
+SNMPv2-MIB::sysContact.0 = STRING: Root &lt;root at localhost&gt; (configure /etc/snmp/snmp.local.conf)
+SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
+SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)</screen>
+        <para>
+          By default, the <systemitem>sysName</systemitem> object is set to the hostname. The <systemitem>sysLocation</systemitem> and <systemitem>sysContact</systemitem> objects can be configured in the <filename>/etc/snmp/snmpd.conf</filename> file by changing the value of the <option>syslocation</option> and <option>syscontact</option> directives, for example:
+        </para>
+        <programlisting>syslocation Datacenter, Row 3, Rack 2
+syscontact UNIX Admin &lt;admin at example.com&gt;</programlisting>
+        <para>
+          After making changes to the configuration file, reload the configuration and test it by running the <command>snmpwalk</command> command again:
+        </para>
+        <screen>~]# <command>service snmpd reload</command>
+Reloading snmpd: [  OK  ]
+~]# <command>snmpwalk -v2c -c public localhost system</command>
+SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
+SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
+DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (158357) 0:26:23.57
+SNMPv2-MIB::sysContact.0 = STRING: UNIX Admin &lt;admin at example.com&gt;
+SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
+SNMPv2-MIB::sysLocation.0 = STRING: Datacenter, Row 3, Rack 2</screen>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Configuring-Authentication">
+        <title>Configuring Authentication</title>
+        <para>
+          The Net-SNMP Agent Daemon supports all three versions of the SNMP protocol. The first two versions (1 and 2c) provide for simple authentication using a <firstterm>community string</firstterm>. This string is a shared secret between the agent and any client utilities. The string is passed in clear text over the network however and is not considered secure. Version 3 of the SNMP protocol supports user authentication and message encryption using a variety of protocols. The Net-SNMP agent also supports tunneling over SSH, TLS authentication with X.509 certificates, and Kerberos authentication.
+        </para>
+        <bridgehead id="brid-System_Monitoring_Tools-Net-SNMP-Configuring_Authentication-2c_community">
+          Configuring SNMP Version 2c Community
+        </bridgehead>
+        <para>
+          To configure an <emphasis role="strong">SNMP version 2c community</emphasis>, use either the <option>rocommunity</option> or <option>rwcommunity</option> directive in the <filename>/etc/snmp/snmpd.conf</filename> configuration file. The format of the directives is the following:
+        </para>
+        <synopsis><replaceable>directive</replaceable> <replaceable>community</replaceable> <optional><replaceable>source</replaceable> <optional><replaceable>OID</replaceable></optional></optional></synopsis>
+        <para>
+          &#8230; where <replaceable>community</replaceable> is the community string to use, <replaceable>source</replaceable> is an IP address or subnet, and <replaceable>OID</replaceable> is the SNMP tree to provide access to. For example, the following directive provides read-only access to the <systemitem>system</systemitem> tree to a client using the community string <quote>redhat</quote> on the local machine:
+        </para>
+        <programlisting>rocommunity redhat 127.0.0.1 .1.3.6.1.2.1.1</programlisting>
+        <para>
+          To test the configuration, use the <command>snmpwalk</command> command with the <option>-v</option> and <option>-c</option> options.
+        </para>
+<screen>~]# <command>snmpwalk -v2c -c redhat localhost system</command>
+SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
+SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
+DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (158357) 0:26:23.57
+SNMPv2-MIB::sysContact.0 = STRING: UNIX Admin &lt;admin at example.com&gt;
+SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
+SNMPv2-MIB::sysLocation.0 = STRING: Datacenter, Row 3, Rack 2</screen>
+        <bridgehead id="brid-System_Monitoring_Tools-Net-SNMP-Configuring_Authentication-3_user">
+          Configuring SNMP Version 3 User
+        </bridgehead>
+        <para>
+          To configure an <emphasis role="strong">SNMP version 3 user</emphasis>, use the <command>net-snmp-create-v3-user</command> command. This command adds entries to the <filename>/var/lib/net-snmp/snmpd.conf</filename> and <filename>/etc/snmp/snmpd.conf</filename> files which create the user and grant access to the user. Note that the <command>net-snmp-create-v3-user</command> command may only be run when the agent is not running. The following example creates the <quote>sysadmin</quote> user with the password <quote>redhatsnmp</quote>:
+        </para>
+        <screen>~]# <command>service snmpd stop</command>
+Stopping snmpd:                                            [  OK  ]
+~]# <command>net-snmp-create-v3-user</command>
+Enter a SNMPv3 user name to create:
+admin
+Enter authentication pass-phrase:
+redhatsnmp
+Enter encryption pass-phrase:
+  [press return to reuse the authentication pass-phrase]
+
+adding the following line to /var/lib/net-snmp/snmpd.conf:
+   createUser admin MD5 "redhatsnmp" DES
+adding the following line to /etc/snmp/snmpd.conf:
+   rwuser admin
+~]# <command>service snmpd start</command>
+Starting snmpd:                                            [  OK  ]</screen>
+        <para>
+          The <option>rwuser</option> directive (or <option>rouser</option> when the <option>-ro</option> command line option is supplied) that <command>net-snmp-create-v3-user</command> adds to <filename>/etc/snmp/snmpd.conf</filename> has a similar format to the <option>rwcommunity</option> and <option>rocommunity</option> directives:
+        </para>
+        <synopsis><replaceable>directive</replaceable> <replaceable>user</replaceable> <optional><option>noauth</option>|<option>auth</option>|<option>priv</option></optional> <optional><replaceable>OID</replaceable></optional></synopsis>
+        <para>
+          &#8230; where <replaceable>user</replaceable> is a username and <replaceable>OID</replaceable> is the SNMP tree to provide access to. By default, the Net-SNMP Agent Daemon allows only authenticated requests (the <option>auth</option> option). The <option>noauth</option> option allows you to permit unauthenticated requests, and the <option>priv</option> option enforces the use of encryption.  The <option>authpriv</option> option specifies that requests must be authenticated and replies should be encrypted.
+        </para>
+        <para>
+          For example, the following line grants the user <quote>admin</quote> read-write access to the entire tree:
+        </para>
+        <programlisting>rwuser admin authpriv .1</programlisting>
+        <para>
+          To test the configuration, create a <filename class="directory">.snmp</filename> directory in your user's home directory and a configuration file named <filename>snmp.conf</filename> in that directory (<filename>~/.snmp/snmp.conf</filename>) with the following lines:
+        </para>
+        <programlisting>defVersion 3
+defSecurityLevel authPriv
+defSecurityName admin
+defPassphrase redhatsnmp</programlisting>
+        <para>
+          The <command>snmpwalk</command> command will now use these authentication settings when querying the agent:
+        </para>
+        <screen>~]$ <command>snmpwalk -v3 localhost system</command>
+SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-122.el6.x86_64 #1 SMP Wed Mar 9 23:54:34 EST 2011 x86_64
+<lineannotation>[output truncated]</lineannotation></screen>
+      </section>
+    </section>
+    <section id="sect-System_Monitoring_Tools-Net-SNMP-Retrieving">
+      <title>Retrieving Performance Data over SNMP</title>
+      <para>
+        The Net-SNMP Agent in &MAJOROS; provides a wide variety of performance information over the SNMP protocol. In addition, the agent can be queried for a listing of the installed RPM packages on the system, a listing of currently running processes on the system, or the network configuration of the system.
+      </para>
+      <para>
+        This section provides an overview of OIDs related to performance tuning available over SNMP. It assumes that the <package>net-snmp-utils</package> package is installed and that the user is granted access to the SNMP tree as described in <xref linkend="sect-System_Monitoring_Tools-Net-SNMP-Configuring-Authentication" />.
+      </para>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Retrieving-Hardware">
+        <title>Hardware Configuration</title>
+        <para>
+          The <systemitem>Host Resources MIB</systemitem> included with Net-SNMP presents information about the current hardware and software configuration of a host to a client utility. <xref linkend="tabl-System_Monitoring_Tools-Net-SNMP-OIDs" /> summarizes the different OIDs available under that MIB.
+        </para>
+        <table id="tabl-System_Monitoring_Tools-Net-SNMP-OIDs">
+          <title>Available OIDs</title>
+          <tgroup cols="2">
+            <colspec colname="OID" colnum="1" colwidth="50*" />
+            <colspec colname="Provides" colnum="2" colwidth="50*" />
+            <thead>
+              <row>
+                <entry>
+                  OID
+                </entry>
+                <entry>
+                  Description
+                </entry>
+              </row>
+            </thead>
+            <tbody>
+              <row>
+                <entry>
+                  <systemitem>HOST-RESOURCES-MIB::hrSystem</systemitem>
+                </entry>
+                <entry>
+                  Contains general system information such as uptime, number of users, and number of running processes.
+                </entry>
+              </row>
+              <row>
+                <entry>
+                  <systemitem>HOST-RESOURCES-MIB::hrStorage</systemitem>
+                </entry>
+                <entry>
+                  Contains data on memory and file system usage.
+                </entry>
+              </row>
+              <row>
+                <entry>
+                  <systemitem>HOST-RESOURCES-MIB::hrDevices</systemitem>
+                </entry>
+                <entry>
+                  Contains a listing of all processors, network devices, and file systems.
+                </entry>
+              </row>
+              <row>
+                <entry>
+                  <systemitem>HOST-RESOURCES-MIB::hrSWRun</systemitem>
+                </entry>
+                <entry>
+                  Contains a listing of all running processes.
+                </entry>
+              </row>
+              <row>
+                <entry>
+                  <systemitem>HOST-RESOURCES-MIB::hrSWRunPerf</systemitem>
+                </entry>
+                <entry>
+                  Contains memory and CPU statistics on the process table from HOST-RESOURCES-MIB::hrSWRun.
+                </entry>
+              </row>
+              <row>
+                <entry>
+                  <systemitem>HOST-RESOURCES-MIB::hrSWInstalled</systemitem>
+                </entry>
+                <entry>
+                  Contains a listing of the RPM database.
+                </entry>
+              </row>
+            </tbody>
+          </tgroup>
+        </table>
+        <para>
+          There are also a number of SNMP tables available in the Host Resources MIB which can be used to retrieve a summary of the available information. The following example displays <systemitem>HOST-RESOURCES-MIB::hrFSTable</systemitem>:
+        </para>
+        <screen>~]$ <command>snmptable -Cb localhost HOST-RESOURCES-MIB::hrFSTable</command>
+SNMP table: HOST-RESOURCES-MIB::hrFSTable
+
+ Index MountPoint RemoteMountPoint                                Type
+    Access Bootable StorageIndex LastFullBackupDate LastPartialBackupDate
+     1        "/"               "" HOST-RESOURCES-TYPES::hrFSLinuxExt2
+ readWrite     true           31      0-1-1,0:0:0.0         0-1-1,0:0:0.0
+     5 "/dev/shm"               ""     HOST-RESOURCES-TYPES::hrFSOther
+ readWrite    false           35      0-1-1,0:0:0.0         0-1-1,0:0:0.0
+     6    "/boot"               "" HOST-RESOURCES-TYPES::hrFSLinuxExt2
+ readWrite    false           36      0-1-1,0:0:0.0         0-1-1,0:0:0.0</screen>
+        <para>
+          For more information about <systemitem>HOST-RESOURCES-MIB</systemitem>, see the <filename>/usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt</filename> file.
+        </para>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Retrieving-CPU">
+        <title>CPU and Memory Information</title>
+        <para>
+          Most system performance data is available in the <systemitem>UCD SNMP MIB</systemitem>. The <systemitem>systemStats</systemitem> OID provides a number of counters around processor usage:
+        </para>
+        <screen>~]$ <command>snmpwalk localhost UCD-SNMP-MIB::systemStats</command>
+UCD-SNMP-MIB::ssIndex.0 = INTEGER: 1
+UCD-SNMP-MIB::ssErrorName.0 = STRING: systemStats
+UCD-SNMP-MIB::ssSwapIn.0 = INTEGER: 0 kB
+UCD-SNMP-MIB::ssSwapOut.0 = INTEGER: 0 kB
+UCD-SNMP-MIB::ssIOSent.0 = INTEGER: 0 blocks/s
+UCD-SNMP-MIB::ssIOReceive.0 = INTEGER: 0 blocks/s
+UCD-SNMP-MIB::ssSysInterrupts.0 = INTEGER: 29 interrupts/s
+UCD-SNMP-MIB::ssSysContext.0 = INTEGER: 18 switches/s
+UCD-SNMP-MIB::ssCpuUser.0 = INTEGER: 0
+UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 0
+UCD-SNMP-MIB::ssCpuIdle.0 = INTEGER: 99
+UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 2278
+UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 1395
+UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 6826
+UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 3383736
+UCD-SNMP-MIB::ssCpuRawWait.0 = Counter32: 7629
+UCD-SNMP-MIB::ssCpuRawKernel.0 = Counter32: 0
+UCD-SNMP-MIB::ssCpuRawInterrupt.0 = Counter32: 434
+UCD-SNMP-MIB::ssIORawSent.0 = Counter32: 266770
+UCD-SNMP-MIB::ssIORawReceived.0 = Counter32: 427302
+UCD-SNMP-MIB::ssRawInterrupts.0 = Counter32: 743442
+UCD-SNMP-MIB::ssRawContexts.0 = Counter32: 718557
+UCD-SNMP-MIB::ssCpuRawSoftIRQ.0 = Counter32: 128
+UCD-SNMP-MIB::ssRawSwapIn.0 = Counter32: 0
+UCD-SNMP-MIB::ssRawSwapOut.0 = Counter32: 0</screen>
+        <para>
+          In particular, the <systemitem>ssCpuRawUser</systemitem>, <systemitem>ssCpuRawSystem</systemitem>, <systemitem>ssCpuRawWait</systemitem>, and <systemitem>ssCpuRawIdle</systemitem> OIDs provide counters which are helpful when determining whether a system is spending most of its processor time in kernel space, user space, or I/O. <systemitem>ssRawSwapIn</systemitem> and <systemitem>ssRawSwapOut</systemitem> can be helpful when determining whether a system is suffering from memory exhaustion.
+        </para>
+        <para>
+          More memory information is available under the <systemitem>UCD-SNMP-MIB::memory</systemitem> OID, which provides similar data to the <command>free</command> command:
+        </para>
+        <screen>~]$ <command>snmpwalk localhost UCD-SNMP-MIB::memory</command>
+UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
+UCD-SNMP-MIB::memErrorName.0 = STRING: swap
+UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1023992 kB
+UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1023992 kB
+UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 1021588 kB
+UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 634260 kB
+UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 1658252 kB
+UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
+UCD-SNMP-MIB::memBuffer.0 = INTEGER: 30760 kB
+UCD-SNMP-MIB::memCached.0 = INTEGER: 216200 kB
+UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
+UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:</screen>
+        <para>
+          Load averages are also available in the <systemitem>UCD SNMP MIB</systemitem>. The SNMP table <systemitem>UCD-SNMP-MIB::laTable</systemitem> has a listing of the 1, 5, and 15 minute load averages:
+        </para>
+        <screen>~]$ <command>snmptable localhost UCD-SNMP-MIB::laTable</command>
+SNMP table: UCD-SNMP-MIB::laTable
+
+ laIndex laNames laLoad laConfig laLoadInt laLoadFloat laErrorFlag laErrMessage
+       1  Load-1   0.00    12.00         0    0.000000     noError
+       2  Load-5   0.00    12.00         0    0.000000     noError
+       3 Load-15   0.00    12.00         0    0.000000     noError</screen>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Retrieving-File_System">
+        <title>File System and Disk Information</title>
+        <para>
+          The <systemitem>Host Resources MIB</systemitem> provides information on file system size and usage. Each file system (and also each memory pool) has an entry in the <systemitem>HOST-RESOURCES-MIB::hrStorageTable</systemitem> table:
+        </para>
+        <screen>~]$ <command>snmptable -Cb localhost HOST-RESOURCES-MIB::hrStorageTable</command>
+SNMP table: HOST-RESOURCES-MIB::hrStorageTable
+
+ Index                                         Type           Descr
+AllocationUnits    Size   Used AllocationFailures
+     1           HOST-RESOURCES-TYPES::hrStorageRam Physical memory
+1024 Bytes 1021588 388064                  ?
+     3 HOST-RESOURCES-TYPES::hrStorageVirtualMemory  Virtual memory
+1024 Bytes 2045580 388064                  ?
+     6         HOST-RESOURCES-TYPES::hrStorageOther  Memory buffers
+1024 Bytes 1021588  31048                  ?
+     7         HOST-RESOURCES-TYPES::hrStorageOther   Cached memory
+1024 Bytes  216604 216604                  ?
+    10 HOST-RESOURCES-TYPES::hrStorageVirtualMemory      Swap space
+1024 Bytes 1023992      0                  ?
+    31     HOST-RESOURCES-TYPES::hrStorageFixedDisk               /
+4096 Bytes 2277614 250391                  ?
+    35     HOST-RESOURCES-TYPES::hrStorageFixedDisk        /dev/shm
+4096 Bytes  127698      0                  ?
+    36     HOST-RESOURCES-TYPES::hrStorageFixedDisk           /boot
+1024 Bytes  198337  26694                  ?</screen>
+        <para>
+          The OIDs under <systemitem>HOST-RESOURCES-MIB::hrStorageSize</systemitem> and <systemitem>HOST-RESOURCES-MIB::hrStorageUsed</systemitem> can be used to calculate the remaining capacity of each mounted file system.
+        </para>
+        <para>
+          I/O data is available both in <systemitem>UCD-SNMP-MIB::systemStats</systemitem> (<systemitem>ssIORawSent.0</systemitem> and <systemitem>ssIORawRecieved.0</systemitem>) and in <systemitem>UCD-DISKIO-MIB::diskIOTable</systemitem>. The latter provides much more granular data. Under this table are OIDs for <systemitem>diskIONReadX</systemitem> and <systemitem>diskIONWrittenX</systemitem>, which provide counters for the number of bytes read from and written to the block device in question since the system boot:
+        </para>
+        <screen>~]$ <command>snmptable -Cb localhost UCD-DISKIO-MIB::diskIOTable</command>
+SNMP table: UCD-DISKIO-MIB::diskIOTable
+
+ Index Device     NRead  NWritten Reads Writes LA1 LA5 LA15    NReadX NWrittenX
+...
+    25    sda 216886272 139109376 16409   4894   ?   ?    ? 216886272 139109376
+    26   sda1   2455552      5120   613      2   ?   ?    ?   2455552      5120
+    27   sda2   1486848         0   332      0   ?   ?    ?   1486848         0
+    28   sda3 212321280 139104256 15312   4871   ?   ?    ? 212321280 139104256</screen>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Retrieving-Network">
+        <title>Network Information</title>
+        <para>
+          Information on network devices is provided by the Interfaces MIB. <systemitem>IF-MIB::ifTable</systemitem> provides an SNMP table with an entry for each interface on the system, the configuration of the interface, and various packet counters for the interface. The following example shows the first few columns of <systemitem>ifTable</systemitem> on a system with two physical network interfaces:
+        </para>
+        <screen>~]$ <command>snmptable -Cb localhost IF-MIB::ifTable</command>
+SNMP table: IF-MIB::ifTable
+
+ Index Descr             Type   Mtu    Speed      PhysAddress AdminStatus
+     1    lo softwareLoopback 16436 10000000                           up
+     2  eth0   ethernetCsmacd  1500        0 52:54:0:c7:69:58          up
+     3  eth1   ethernetCsmacd  1500        0 52:54:0:a7:a3:24        down</screen>
+        <para>
+          Network traffic is available under the OIDs <systemitem>IF-MIB::ifOutOctets</systemitem> and <systemitem>IF-MIB::ifInOctets</systemitem>. The following SNMP queries will retrieve network traffic for each of the interfaces on this system:
+        </para>
+        <screen>~]$ <command>snmpwalk localhost IF-MIB::ifDescr</command>
+IF-MIB::ifDescr.1 = STRING: lo
+IF-MIB::ifDescr.2 = STRING: eth0
+IF-MIB::ifDescr.3 = STRING: eth1
+~]$ <command>snmpwalk localhost IF-MIB::ifOutOctets</command>
+IF-MIB::ifOutOctets.1 = Counter32: 10060699
+IF-MIB::ifOutOctets.2 = Counter32: 650
+IF-MIB::ifOutOctets.3 = Counter32: 0
+~]$ <command>snmpwalk localhost IF-MIB::ifInOctets</command>
+IF-MIB::ifInOctets.1 = Counter32: 10060699
+IF-MIB::ifInOctets.2 = Counter32: 78650
+IF-MIB::ifInOctets.3 = Counter32: 0</screen>
+      </section>
+    </section>
+    <section id="sect-System_Monitoring_Tools-Net-SNMP-Extending">
+      <title>Extending Net-SNMP</title>
+      <para>
+        The Net-SNMP Agent can be extended to provide application metrics in addition to raw system metrics. This allows for capacity planning as well as performance issue troubleshooting. For example, it may be helpful to know that an email system had a 5-minute load average of 15 while being tested, but it is more helpful to know that the email system has a load average of 15 while processing 80,000 messages a second. When application metrics are available via the same interface as the system metrics, this also allows for the visualization of the impact of different load scenarios on system performance (for example, each additional 10,000 messages increases the load average linearly until 100,000).
+      </para>
+      <para>
+        A number of the applications that ship with &MAJOROS; extend the Net-SNMP Agent to provide application metrics over SNMP. There are several ways to extend the agent for custom applications as well. This section describes extending the agent with shell scripts and Perl plug-ins. It assumes that the <package>net-snmp-utils</package> and <package>net-snmp-perl</package> packages are installed, and that the user is granted access to the SNMP tree as described in <xref linkend="sect-System_Monitoring_Tools-Net-SNMP-Configuring-Authentication" />.
+      </para>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Extending-Shell">
+        <title>Extending Net-SNMP with Shell Scripts</title>
+        <para>
+          The Net-SNMP Agent provides an extension MIB (<systemitem>NET-SNMP-EXTEND-MIB</systemitem>) that can be used to query arbitrary shell scripts. To specify the shell script to run, use the <option>extend</option> directive in the <filename>/etc/snmp/snmpd.conf</filename> file. Once defined, the Agent will provide the exit code and any output of the command over SNMP. The example below demonstrates this mechanism with a script which determines the number of <systemitem class="service">httpd</systemitem> processes in the process table.
+        </para>
+        <note>
+          <title>Using the proc directive</title>
+          <para>
+            The Net-SNMP Agent also provides a built-in mechanism for checking the process table via the <option>proc</option> directive. Refer to the <emphasis role="bold">snmpd.conf</emphasis>(5) manual page for more information.
+          </para>
+        </note>
+        <para>
+          The exit code of the following shell script is the number of <command>httpd</command> processes running on the system at a given point in time:
+        </para>
+        <programlisting language="Bash">#!/bin/sh
+
+NUMPIDS=`pgrep httpd | wc -l`
+
+exit $NUMPIDS</programlisting>
+        <para>
+          To make this script available over SNMP, copy the script to a location on the system path, set the executable bit, and add an <option>extend</option> directive to the <filename>/etc/snmp/snmpd.conf</filename> file. The format of the <option>extend</option> directive is the following:
+        </para>
+        <synopsis><option>extend</option> <replaceable>name</replaceable> <replaceable>prog</replaceable> <replaceable>args</replaceable></synopsis>
+        <para>
+          &#8230; where <replaceable>name</replaceable> is an identifying string for the extension, <replaceable>prog</replaceable> is the program to run, and <replaceable>args</replaceable> are the arguments to give the program. For instance, if the above shell script is copied to <filename>/usr/local/bin/check_apache.sh</filename>, the following directive will add the script to the SNMP tree:
+        </para>
+        <programlisting>extend httpd_pids /bin/sh /usr/local/bin/check_apache.sh</programlisting>
+        <para>
+          The script can then be queried at <systemitem>NET-SNMP-EXTEND-MIB::nsExtendObjects</systemitem>:
+        </para>
+        <screen>~]$ <command>snmpwalk localhost NET-SNMP-EXTEND-MIB::nsExtendObjects</command>
+NET-SNMP-EXTEND-MIB::nsExtendNumEntries.0 = INTEGER: 1
+NET-SNMP-EXTEND-MIB::nsExtendCommand."httpd_pids" = STRING: /bin/sh
+NET-SNMP-EXTEND-MIB::nsExtendArgs."httpd_pids" = STRING: /usr/local/bin/check_apache.sh
+NET-SNMP-EXTEND-MIB::nsExtendInput."httpd_pids" = STRING:
+NET-SNMP-EXTEND-MIB::nsExtendCacheTime."httpd_pids" = INTEGER: 5
+NET-SNMP-EXTEND-MIB::nsExtendExecType."httpd_pids" = INTEGER: exec(1)
+NET-SNMP-EXTEND-MIB::nsExtendRunType."httpd_pids" = INTEGER: run-on-read(1)
+NET-SNMP-EXTEND-MIB::nsExtendStorage."httpd_pids" = INTEGER: permanent(4)
+NET-SNMP-EXTEND-MIB::nsExtendStatus."httpd_pids" = INTEGER: active(1)
+NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."httpd_pids" = STRING:
+NET-SNMP-EXTEND-MIB::nsExtendOutputFull."httpd_pids" = STRING:
+NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."httpd_pids" = INTEGER: 1
+NET-SNMP-EXTEND-MIB::nsExtendResult."httpd_pids" = INTEGER: 8
+NET-SNMP-EXTEND-MIB::nsExtendOutLine."httpd_pids".1 = STRING:</screen>
+        <para>
+          Note that the exit code (<quote>8</quote> in this example) is provided as an INTEGER type and any output is provided as a STRING type. To expose multiple metrics as integers, supply different arguments to the script using the <option>extend</option> directive. For example, the following shell script can be used to determine the number of processes matching an arbitrary string, and will also output a text string giving the number of processes:
+        </para>
+        <programlisting language="Bash">#!/bin/sh
+
+PATTERN=$1
+NUMPIDS=`pgrep $PATTERN | wc -l`
+
+echo "There are $NUMPIDS $PATTERN processes."
+exit $NUMPIDS</programlisting>
+        <para>
+          The following <filename>/etc/snmp/snmpd.conf</filename> directives will give both the number of <systemitem class="service">httpd</systemitem> PIDs as well as the number of <systemitem class="service">snmpd</systemitem> PIDs when the above script is copied to <filename>/usr/local/bin/check_proc.sh</filename>:
+        </para>
+        <programlisting>extend httpd_pids /bin/sh /usr/local/bin/check_proc.sh httpd
+extend snmpd_pids /bin/sh /usr/local/bin/check_proc.sh snmpd</programlisting>
+        <para>
+          The following example shows the output of an <command>snmpwalk</command> of the <systemitem>nsExtendObjects</systemitem> OID:
+        </para>
+        <screen>~]$ <command>snmpwalk localhost NET-SNMP-EXTEND-MIB::nsExtendObjects</command>
+NET-SNMP-EXTEND-MIB::nsExtendNumEntries.0 = INTEGER: 2
+NET-SNMP-EXTEND-MIB::nsExtendCommand."httpd_pids" = STRING: /bin/sh
+NET-SNMP-EXTEND-MIB::nsExtendCommand."snmpd_pids" = STRING: /bin/sh
+NET-SNMP-EXTEND-MIB::nsExtendArgs."httpd_pids" = STRING: /usr/local/bin/check_proc.sh httpd
+NET-SNMP-EXTEND-MIB::nsExtendArgs."snmpd_pids" = STRING: /usr/local/bin/check_proc.sh snmpd
+NET-SNMP-EXTEND-MIB::nsExtendInput."httpd_pids" = STRING:
+NET-SNMP-EXTEND-MIB::nsExtendInput."snmpd_pids" = STRING:
+...
+NET-SNMP-EXTEND-MIB::nsExtendResult."httpd_pids" = INTEGER: 8
+NET-SNMP-EXTEND-MIB::nsExtendResult."snmpd_pids" = INTEGER: 1
+NET-SNMP-EXTEND-MIB::nsExtendOutLine."httpd_pids".1 = STRING: There are 8 httpd processes.
+NET-SNMP-EXTEND-MIB::nsExtendOutLine."snmpd_pids".1 = STRING: There are 1 snmpd processes.</screen>
+        <warning>
+          <title>Integer exit codes are limited</title>
+          <para>
+            Integer exit codes are limited to a range of 0–255. For values that are likely to exceed 256, either use the standard output of the script (which will be typed as a string) or a different method of extending the agent.
+          </para>
+        </warning>
+        <para>
+          This last example shows a query for the free memory of the system and the number of <systemitem class="service">httpd</systemitem> processes. This query could be used during a performance test to determine the impact of the number of processes on memory pressure:
+        </para>
+<screen>~]$ <command>snmpget localhost \</command>
+    <command>'NET-SNMP-EXTEND-MIB::nsExtendResult."httpd_pids"' \</command>
+    <command>UCD-SNMP-MIB::memAvailReal.0</command>
+NET-SNMP-EXTEND-MIB::nsExtendResult."httpd_pids" = INTEGER: 8
+UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 799664 kB</screen>
+      </section>
+      <section id="sect-System_Monitoring_Tools-Net-SNMP-Extending-Perl">
+        <title>Extending Net-SNMP with Perl</title>
+        <para>
+          Executing shell scripts using the <option>extend</option> directive is a fairly limited method for exposing custom application metrics over SNMP. The Net-SNMP Agent also provides an embedded Perl interface for exposing custom objects. The <package>net-snmp-perl</package> package provides the <filename>NetSNMP::agent</filename> Perl module that is used to write embedded Perl plug-ins on &MAJOROS;.
+        </para>
+        <para>
+          The <filename>NetSNMP::agent</filename> Perl module provides an <classname>agent</classname> object which is used to handle requests for a part of the agent's OID tree. The <classname>agent</classname> object's constructor has options for running the agent as a sub-agent of <systemitem class="service">snmpd</systemitem> or a standalone agent. No arguments are necessary to create an embedded agent:
+        </para>
+        <programlisting language="Perl"><![CDATA[use NetSNMP::agent (':all');
+
+my $agent = new NetSNMP::agent();]]></programlisting>
+        <para>
+          The <classname>agent</classname> object has a <methodname>register</methodname> method which is used to register a callback function with a particular OID. The <methodname>register</methodname> function takes a name, OID, and pointer to the callback function. The following example will register a callback function named <function>hello_handler</function> with the SNMP Agent which will handle requests under the OID <literal>.1.3.6.1.4.1.8072.9999.9999</literal>:
+        </para>
+        <programlisting language="Perl"><![CDATA[$agent->register("hello_world", ".1.3.6.1.4.1.8072.9999.9999",
+                 \&hello_handler);]]></programlisting>
+        <note>
+          <title>Obtaining a root OID</title>
+          <para>
+            The OID <literal>.1.3.6.1.4.1.8072.9999.9999</literal> (<systemitem>NET-SNMP-MIB::netSnmpPlaypen</systemitem>) is typically used for demonstration purposes only. If your organization does not already have a root OID, you can obtain one by contacting your Name Registration Authority (ANSI in the United States).
+          </para>
+        </note>
+        <para>
+          The handler function will be called with four parameters, <parameter>HANDLER</parameter>, <parameter>REGISTRATION_INFO</parameter>, <parameter>REQUEST_INFO</parameter>, and <parameter>REQUESTS</parameter>. The <parameter>REQUESTS</parameter> parameter contains a list of requests in the current call and should be iterated over and populated with data. The <classname>request</classname> objects in the list have get and set methods which allow for manipulating the <property>OID</property> and <property>value</property> of the request. For example, the following call will set the value of a request object to the string <quote>hello world</quote>:
+        </para>
+        <programlisting language="Perl">$request-&gt;setValue(ASN_OCTET_STR, "hello world");</programlisting>
+        <para>
+          The handler function should respond to two types of SNMP requests: the GET request and the GETNEXT request. The type of request is determined by calling the <methodname>getMode</methodname> method on the <classname>request_info</classname> object passed as the third parameter to the handler function. If the request is a GET request, the caller will expect the handler to set the <property>value</property> of the <classname>request</classname> object, depending on the OID of the request. If the request is a GETNEXT request, the caller will also expect the handler to set the OID of the request to the next available OID in the tree. This is illustrated in the following code example:
+        </para>
+        <programlisting language="Perl"><![CDATA[my $request;
+my $string_value = "hello world";
+my $integer_value = "8675309";
+
+for($request = $requests; $request; $request = $request->next()) {
+  my $oid = $request->getOID();
+  if ($request_info->getMode() == MODE_GET) {
+    if ($oid == new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.0")) {
+      $request->setValue(ASN_OCTET_STR, $string_value);
+    }
+    elsif ($oid == new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.1")) {
+      $request->setValue(ASN_INTEGER, $integer_value);
+    }
+  } elsif ($request_info->getMode() == MODE_GETNEXT) {
+    if ($oid == new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.0")) {
+      $request->setOID(".1.3.6.1.4.1.8072.9999.9999.1.1");
+      $request->setValue(ASN_INTEGER, $integer_value);
+    }
+    elsif ($oid < new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.0")) {
+      $request->setOID(".1.3.6.1.4.1.8072.9999.9999.1.0");
+      $request->setValue(ASN_OCTET_STR, $string_value);
+    }
+  }
+}]]></programlisting>
+        <para>
+          When <methodname>getMode</methodname> returns <literal>MODE_GET</literal>, the handler analyzes the value of the <methodname>getOID</methodname> call on the <classname>request</classname> object. The <property>value</property> of the <classname>request</classname> is set to either <varname>string_value</varname> if the OID ends in <quote>.1.0</quote>, or set to <varname>integer_value</varname> if the OID ends in <quote>.1.1</quote>. If the <methodname>getMode</methodname> returns <literal>MODE_GETNEXT</literal>, the handler determines whether the OID of the request is <quote>.1.0</quote>, and then sets the OID and value for <quote>.1.1</quote>. If the request is higher on the tree than <quote>.1.0</quote>, the OID and value for <quote>.1.0</quote> is set. This in effect returns the <quote>next</quote> value in the tree so that a program like <command>snmpwalk</command> can traverse the tree without prior knowledge of the structure.
+        </para>
+        <para>
+          The type of the variable is set using constants from <classname>NetSNMP::ASN</classname>. See the <command>perldoc</command> for <classname>NetSNMP::ASN</classname> for a full list of available constants.
+        </para>
+        <para>
+          The entire code listing for this example Perl plug-in is as follows:
+        </para>
+        <programlisting language="Perl"><![CDATA[#!/usr/bin/perl
+
+use NetSNMP::agent (':all');
+use NetSNMP::ASN qw(ASN_OCTET_STR ASN_INTEGER);
+
+sub hello_handler {
+  my ($handler, $registration_info, $request_info, $requests) = @_;
+  my $request;
+  my $string_value = "hello world";
+  my $integer_value = "8675309";
+
+  for($request = $requests; $request; $request = $request->next()) {
+    my $oid = $request->getOID();
+    if ($request_info->getMode() == MODE_GET) {
+      if ($oid == new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.0")) {
+        $request->setValue(ASN_OCTET_STR, $string_value);
+      }
+      elsif ($oid == new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.1")) {
+        $request->setValue(ASN_INTEGER, $integer_value);
+      }
+    } elsif ($request_info->getMode() == MODE_GETNEXT) {
+      if ($oid == new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.0")) {
+        $request->setOID(".1.3.6.1.4.1.8072.9999.9999.1.1");
+        $request->setValue(ASN_INTEGER, $integer_value);
+      }
+      elsif ($oid < new NetSNMP::OID(".1.3.6.1.4.1.8072.9999.9999.1.0")) {
+        $request->setOID(".1.3.6.1.4.1.8072.9999.9999.1.0");
+        $request->setValue(ASN_OCTET_STR, $string_value);
+      }
+    }
+  }
+}
+
+my $agent = new NetSNMP::agent();
+$agent->register("hello_world", ".1.3.6.1.4.1.8072.9999.9999",
+                 \&hello_handler);]]></programlisting>
+        <para>
+          To test the plug-in, copy the above program to <filename>/usr/share/snmp/hello_world.pl</filename> and add the following line to the <filename>/etc/snmp/snmpd.conf</filename> configuration file:
+        </para>
+        <programlisting>perl do "/usr/share/snmp/hello_world.pl"</programlisting>
+        <para>
+          The SNMP Agent Daemon will need to be restarted to load the new Perl plug-in. Once it has been restarted, an <command>snmpwalk</command> should return the new data:
+        </para>
+        <screen>~]$ <command>snmpwalk localhost NET-SNMP-MIB::netSnmpPlaypen</command>
+NET-SNMP-MIB::netSnmpPlaypen.1.0 = STRING: "hello world"
+NET-SNMP-MIB::netSnmpPlaypen.1.1 = INTEGER: 8675309</screen>
+        <para>
+          The <command>snmpget</command> should also be used to exercise the other mode of the handler:
+        </para>
+        <screen>~]$ <command>snmpget localhost \</command>
+    <command>NET-SNMP-MIB::netSnmpPlaypen.1.0 \</command>
+    <command>NET-SNMP-MIB::netSnmpPlaypen.1.1</command>
+NET-SNMP-MIB::netSnmpPlaypen.1.0 = STRING: "hello world"
+NET-SNMP-MIB::netSnmpPlaypen.1.1 = INTEGER: 8675309</screen>
+      </section>
+    </section>
+  </section>
+  <section id="s1-sysinfo-additional-resources">
     <title>Additional Resources</title>
-    <para>To learn more about gathering system information, refer to the following resources.</para>
-    <section
-      id="s2-sysinfo-installed-docs">
+    <para>
+      To learn more about gathering system information, refer to the following resources.
+    </para>
+    <section id="s2-sysinfo-installed-docs">
       <title>Installed Documentation</title>
       <itemizedlist>
         <listitem>
           <para>
-            <command>ps --help</command> — Displays a list of options that can be used with <command>ps</command>.</para>
+            <emphasis role="bold">ps</emphasis>(1) — The manual page for the <command>ps</command> command.
+          </para>
+        </listitem>
+        <listitem>
+          <para>
+            <emphasis role="bold">top</emphasis>(1) — The manual page for the <command>top</command> command.
+          </para>
         </listitem>
         <listitem>
           <para>
-            <command>top</command> manual page — Execute <command>man top</command> to learn more about <command>top</command> and its many options.</para>
+            <emphasis role="bold">free</emphasis>(1) — The manual page for the <command>free</command> command.
+          </para>
         </listitem>
         <listitem>
           <para>
-            <command>free</command> manual page — Execute <command>man free</command> to learn more about <command>free</command> and its many options.</para>
+            <emphasis role="bold">df</emphasis>(1) — The manual page for the <command>df</command> command.
+          </para>
         </listitem>
         <listitem>
           <para>
-            <command>df</command> manual page — Execute <command>man df</command> to learn more about the <command>df</command> command and its many options.</para>
+            <emphasis role="bold">du</emphasis>(1) — The manual page for the <command>du</command> command.
+          </para>
         </listitem>
         <listitem>
           <para>
-            <command>du</command> manual page — Execute <command>man du</command> to learn more about the <command>du</command> command and its many options.</para>
+            <emphasis role="bold">lspci</emphasis>(8) — The manual page for the <command>lspci</command> command.
+          </para>
         </listitem>
         <listitem>
           <para>
-            <command>lspci</command> manual page — Execute <command>man lspci</command> to learn more about the <command>lspci</command> command and its many options.</para>
+            <emphasis role="bold">snmpd</emphasis>(8) — The manual page for the <systemitem class="service">snmpd</systemitem> service.
+          </para>
         </listitem>
         <listitem>
           <para>
-            <indexterm
-              significance="normal">
-              <primary>
-                <filename>/proc/</filename> directory</primary>
-            </indexterm>
-            <filename>/proc/</filename> directory — The contents of the <filename>/proc/</filename> directory can also be used to gather more detailed system information.</para>
+            <emphasis role="bold">snmpd.conf</emphasis>(5) — The manual page for the <filename>/etc/snmp/snmpd.conf</filename> file containing full documentation of available configuration directives.
+          </para>
         </listitem>
       </itemizedlist>
     </section>


More information about the docs-commits mailing list