コード例 #1
0
ファイル: io.php プロジェクト: ryanflannery/phpsymon
function display_single_io(&$drive)
{
    ?>
   <tr>
      <td><?php 
    echo $drive['name'];
    ?>
:</td>
      <td class='num'><?php 
    echo fmtmem($drive['total_rbytes']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($drive['total_wbytes']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($drive['total_rxfer']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($drive['total_wxfer']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($drive['total_seeks']);
    ?>
</td>
   </tr>
   <?php 
}
コード例 #2
0
ファイル: if.php プロジェクト: ryanflannery/phpsymon
function display_single_if(&$if)
{
    ?>
   <tr>
      <td><?php 
    echo $if['name'];
    ?>
:</td>
      <td class='num'><?php 
    echo fmtmem($if['bytes_in']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($if['bytes_out']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['packets_in']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['packets_out']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['multicasts_in']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['multicasts_out']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['errors_in']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['errors_out']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['collisions']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($if['drops']);
    ?>
</td>
   </tr>
   <tr>
      <td colspan='11'></td>
   </tr>
   <?php 
}
コード例 #3
0
ファイル: proc.php プロジェクト: ryanflannery/phpsymon
function display_single_proc(&$proc)
{
    ?>
   <tr>
      <td><?php 
    echo $proc['name'];
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($proc['number']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($proc['procsz']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($proc['rsssz']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($proc['uticks']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($proc['sticks']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($proc['iticks']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($proc['cpusec']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($proc['cpupct']);
    ?>
</td>
   </tr>
   <?php 
}
コード例 #4
0
ファイル: mem.php プロジェクト: ryanflannery/phpsymon
function display_mem(&$memory)
{
    global $config;
    if (!isset($memory)) {
        echo "No MEM information available.";
        return;
    }
    // Calculate the total amount of main memory present
    $mem = array_shift($memory);
    $total = $mem['real_total'] + $mem['free'];
    ?>
   <h2>Memory</h2>
   <table class='datum_section'>
   <tr>
      <td><b>Main:</b></td>
      <td>
         <table width='100%'>
         <tr>
            <td style='white-space: nowrap;'>
               <b>Active/Used/Free:</b>
               <?php 
    // Display main memory amounts
    echo fmtmem($mem['real_active']) . "&nbsp;/&nbsp;";
    echo fmtmem($mem['real_total']) . "&nbsp;/&nbsp;";
    echo fmtmem($mem['free']);
    ?>
            </td>
            <td style='white-space: nowrap;'>
               &nbsp;&nbsp;<b>Total:</b> <?php 
    echo fmtmem($total);
    ?>
            </td>
         </tr>
         </table>
      </td>
   </tr>

      <tr>
         <td></td>
         <td><?php 
    // Calculate width of various status bar colors
    $activeWidth = round($mem['real_active'] / $total * 100);
    $usedWidth = ($mem['real_total'] - $mem['real_active']) / $total;
    $usedWidth = round($usedWidth * 100);
    $freeWidth = 100 - ($activeWidth + $usedWidth);
    echo statusbar(array($activeWidth => 'red', $usedWidth => 'yellow', $freeWidth => 'green'));
    ?>
</td>
      </tr>

   <tr>
      <td><b>Swap:</b></td>
      <td>
         <div style='float: right;'>
            <b>Total:</b> <?php 
    echo fmtmem($mem['swap_total']);
    ?>
         </div>
         <b>Used / Free:</b>
         <?php 
    echo fmtmem($mem['swap_used']) . "&nbsp;/&nbsp;";
    echo fmtmem($mem['swap_total'] - $mem['swap_used']);
    ?>
      </td>
   </tr>

      <tr>
         <td></td>
         <td><?php 
    $usedWidth = round($mem['swap_used'] / $mem['swap_total'] * 100);
    $freeWidth = 100 - $usedWidth;
    echo statusbar(array($usedWidth => 'red', $freeWidth => 'green'));
    ?>
</td>
      </tr>

      <tr>
         <td colspan='2'>
            <small>
               <?php 
    echo colorsquare('red');
    ?>
      = Active
               <?php 
    echo colorsquare('red');
    ?>
      +
               <?php 
    echo colorsquare('yellow');
    ?>
   = Used
               <?php 
    echo colorsquare('green');
    ?>
    = Free
            </small>
         </td>
      </tr>

   </table>
<?php 
}
コード例 #5
0
ファイル: mbuf.php プロジェクト: ryanflannery/phpsymon
function display_mbuf(&$mbuf)
{
    if (!isset($mbuf)) {
        echo "No MBUF information avialable";
        return;
    }
    $mbuf = array_shift($mbuf);
    ?>
   <h2>mbuf Usage</h2>
   <table class='datum_section'>
   <tr>
      <td colspan='6'><?php 
    echo $mbuf['totmbufs'];
    ?>
 mbufs in use:</td>
   </tr>
   <tr>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['mt_data'];
    ?>
</td>
      <td>data</td>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['mt_ftable'];
    ?>
</td>
      <td>frag reassembly hdrs</td>
   </tr>
   <tr>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['mt_header'];
    ?>
</td>
      <td>packet hdrs</td>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['mt_control'];
    ?>
</td>
      <td>extra data protocol msgs</td>
   </tr>
   <tr>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['mt_soname'];
    ?>
</td>
      <td>sock. names / addrs</td>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['mt_soopts'];
    ?>
</td>
      <td>sock. options</td>
   </tr>
   <tr>
      <td colspan='4'></td>
      <td class='num'><?php 
    echo $mbuf['mt_oobdata'];
    ?>
</td>
      <td>out-of-band data</td>
   </tr>

   <tr><td colspan='6'><hr /></td></tr>

   <tr><td colspan='6'>

   <table>
   <tr>
   <td class='num'>
      <?php 
    echo $mbuf['pgused'];
    ?>
&nbsp;/&nbsp;<?php 
    echo $mbuf['pgtotal'];
    ?>
   </td>
   <td>
      mbuf clusers in use (current/peak)
   </td>
   </tr>
   <tr>
   <td class='num'>
      <?php 
    echo fmtmem($mbuf['totmem']);
    ?>
   </td>
   <td>
      allocated to network (<?php 
    echo fmtnum($mbuf['totpct']);
    ?>
% in use)
   </td>
   </tr>
   </table>

   </td></tr>

   <tr><td colspan='6'><hr /></td></tr>

   <tr>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['m_drops'];
    ?>
</td>
      <td>requests for memory denied</td>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['m_drain'];
    ?>
</td>
      <td>calls to protocol drain routines</td>
   </tr>
   <tr>
      <td></td>
      <td class='num'><?php 
    echo $mbuf['m_wait'];
    ?>
</td>
      <td colspan='4'>requests for memory delayed</td>
   </tr>
   </table>
   <?php 
}
コード例 #6
0
ファイル: df.php プロジェクト: ryanflannery/phpsymon
function display_single_df(&$df)
{
    global $alias;
    $blocksUsed = $df['blocks'] - $df['bfree'];
    $filesTotal = $df['files'] + $df['ffree'];
    ?>
   <tr>
      <td><?php 
    echo $df['name'];
    ?>
:</td>
      <td>
      <?php 
    if (isset($alias['df'][$df['name']]['mount'])) {
        echo $alias['df'][$df['name']]['mount'];
    }
    ?>
      </td>
      <td class='bar'><?php 
    $usedWidth = round($blocksUsed / $df['blocks'] * 100);
    $freeWidth = 100 - $usedWidth;
    echo statusbar(array($usedWidth => 'red', $freeWidth => 'green'));
    ?>
</td>

      <td class='num'><?php 
    echo fmtmem($df['blocks'] * 512);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($blocksUsed * 512);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($df['bavail'] * 512);
    ?>
</td>
      <td class='num'><?php 
    echo $usedWidth;
    ?>
%</td>

      <td class='num'><?php 
    echo fmtnum($df['files']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($df['ffree']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($filesTotal);
    ?>
</td>

      <td class='num'><?php 
    echo fmtnum($df['synwrites']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($df['asyncwrites']);
    ?>
</td>
   </tr>
   <?php 
}
コード例 #7
0
ファイル: pf.php プロジェクト: ryanflannery/phpsymon
function display_pf(&$pf)
{
    global $config;
    if (!isset($pf)) {
        echo "No PF information available";
        return;
    }
    // Grab the PF config data
    $pfConfig =& $config['display']['pf'];
    $pf = array_shift($pf);
    ?>
   <h2>PF</h2>
   <table class='datum_section'>
   <tr><td>

   <!-- BEGIN PF bandwidth/packet table -->
   <table>
   <tr>
      <td></td>
      <th colspan='2'>Bandwidth</th>
      <th colspan='2'>Packets In</th>
      <th colspan='2'>Packets Out</th>
   </tr>
   <tr>
      <th>IPv</th>
      <th>Pass</th>
      <th>Drop</th>
      <th>Pass</th>
      <th>Drop</th>
      <th>Pass</th>
      <th>Drop</th>
   </tr>

   <tr>
      <td>IPv4:</td>
      <td class='num'><?php 
    echo fmtmem($pf['bytes_v4_in']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($pf['bytes_v4_out']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v4_in_pass']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v4_in_drop']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v4_out_pass']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v4_out_drop']);
    ?>
</td>
   </tr>

   <tr>
      <td colspan='7'></td>
   </tr>

   <tr>
      <td>IPv6:</td>
      <td class='num'><?php 
    echo fmtmem($pf['bytes_v6_in']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtmem($pf['bytes_v6_out']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v6_in_pass']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v6_in_drop']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v6_out_pass']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['packets_v6_out_drop']);
    ?>
</td>
   </tr>

   <!-- Spacer Row - also provides bottom-border to the 'sub-tables' -->
   <tr>
      <td colspan='7'></td>
   </tr>
   </table>
   <!-- END PF bandwidth/packet table -->


   </td></tr><tr><td>


   <!-- BEGIN PF counter table -->
   <table>
   <tr>
      <th colspan='6'>Counters</td>
   </tr>
   <tr>
      <th>Match</th>
      <th>Bad-Offset</th>
      <th>Fragment</th>
      <th>Short</th>
      <th>Normalize</th>
      <th>Memory</th>
   </tr>
   <tr>
      <td class='num'><?php 
    echo fmtnum($pf['counters_match']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['counters_badoffset']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['counters_fragment']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['counters_short']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['counters_normalize']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['counters_memory']);
    ?>
</td>
   </tr>
   <tr>
      <td colspan='6' class='tb'></td>
   </tr>
   </table>
   <!-- END PF counter table -->


   </td></tr><tr><td>


   <!-- BEGIN PF state table -->
   <table>
   <tr>
      <th colspan='4'>State Table</th>
   </tr>
   <tr>
      <th>Entries</th>
      <th>Searches</th>
      <th>Inserts</th>
      <th>Removals</th>
   </tr>
   <tr>
      <td class='num'><?php 
    echo fmtnum($pf['states_entries']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['states_searches']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['states_inserts']);
    ?>
</td>
      <td class='num'><?php 
    echo fmtnum($pf['states_removals']);
    ?>
</td>
   </tr>
   <tr>
      <td colspan='4' class='tb'></td>
   </tr>
   </table>
   <!-- END PF state table -->

   </td></tr>
   </table>
   <?php 
}