<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.1-alpha" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
	<title>the occasional blog</title>
	<link>http://rajeev.blogsome.com</link>
	<description>BETA site  for kreaper.blogsome.com</description>
	<pubDate>Sun, 04 Mar 2007 03:57:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<item>
		<title>user quotas</title>
		<link>http://rajeev.blogsome.com/2007/03/04/user-quotas/</link>
		<comments>http://rajeev.blogsome.com/2007/03/04/user-quotas/#comments</comments>
		<pubDate>Sun, 04 Mar 2007 03:57:54 +0000</pubDate>
		<dc:creator>rajeev</dc:creator>
		
	<category>sysadmin</category>
		<guid>http://rajeev.blogsome.com/2007/03/04/user-quotas/</guid>
		<description><![CDATA[	If you are an ibrix customer, you probably know that you while you can configure an ibrix file system with user quotas, there are no userland tools available to actually check for those quotas. Using Net-SNMP package, however, we can overcome this shortcoming. Extend, to the rescue!
	
	IBRIX user quotas are managed on the fusion manager [...]]]></description>
			<content:encoded><![CDATA[	<p>If you are an ibrix customer, you probably know that you while you can configure an ibrix file system with user quotas, there are no userland tools available to actually check for those quotas. Using Net-SNMP package, however, we can overcome this shortcoming. <strong><em>Extend</em></strong>, to the rescue!</p>
	<p><a id="more-15"></a></p>
	<p>IBRIX user quotas are managed on the <span style="font-style: italic;">fusion manager</span> server. </p>
	<p><code><br />[root@fusionmgr]# /usr/local/ibrix/bin/ibrix_edquota -h</p>
	<p>[ ibrix_edquota -h ]<br />Usage: ibrix_edquota<br /> -? : Display the command usage<br /> -G : All groups <br /> -I : Soft limits (files) <br /> -M : Soft limits (MB) <br /> -U : All users <br /> -f : Name of filesystem<br /> -g : Group ID or Name <br /> -i : Hard limits (files) <br /> -l : list quota limits<br /> -m : Hard limits (MB) <br /> -s : Set quota limits<br /> -u : User ID or Name</p>
	<p>ibrix_edquota: Usage Patterns<br />
<br />=======================================</p>
	<p>ibrix_edquota -s -g GROUP -f FSNAME -M SOFT_MEGABYTES -m HARD_MEGABYTES -I SOFT_FILES -i HARD_FILES<br />                : set the specified usage limits on FSNAME for group GID<br />ibrix_edquota -s -u USER -f FSNAME -M SOFT_MEGABYTES -m HARD_MEGABYTES -I SOFT_FILES -i HARD_FILES<br />                : set the specified usage limits on FSNAME for user UID<br />ibrix_edquota -l -u UID [-f FSNAME]<br />                : list the usage limits for user UID<br />ibrix_edquota -l -g GID [-f FSNAME]<br />                : list the usage limits for group GID<br />ibrix_edquota -l -U [-f FSNAME]<br />                : list the usage limits for all USERS<br />ibrix_edquota -l -G [-f FSNAME]<br />                : list the usage limits for all GROUPS<br />ibrix_edquota -?</p>
	<p>COMMAND LINE: ibrix_edquota -h  IS INVALID<br /></code></p>
	<p>The user quotas are setup using the <code>ibrix_edquota -s ... </code> command.  The listing of user quotas is also done using the <code>ibrix_edquota -l </code> command. Since this command is not available on any other server, there is no direct way for a normal user to get quota information.</p>
	<p>I used the <a href="http://net-snmp.sourceforge.net">Net-SNMP</a> package and <a href="http://net-snmp.sourceforge.net/docs/man/snmpd.conf.html">its ability to extend the functionality</a> of the agent. In theory, it is very simple. Configure SNMP to run <code>ibrix_edquota</code> command everytime an a preset OID is queried. I used the  <span style="font-weight: bold;"></span><span style="font-style: italic;">extend</span> directive, since it has performance improvements over the older directives, <span style="font-style: italic;">exec, pass and pass_persist</span>.</p>
	<p><span style="text-decoration: underline;"></span><span style="font-weight: bold;">Setting up SNMP</span></p>
	<ol>
<li>First, we need a script that will run the ibrix_edquota command for a given file system. <br /><code><br />#!/usr/bin/perl</p>
	<p>#<br /># ibrix_quota.pl<br />#<br />$|=1;</p>
	<p>#======================================#<br /># Process args                         #<br />#======================================#</p>
	<p>$req = $ARGV[0];</p>
	<p>if (!$req) {<br />        exit 1;<br />}</p>
	<p>open (OUTPUT, &#8220;/usr/local/ibrix/bin/ibrix_edquota -f $req -l -U | grep -v &#8216;Filesystem&#8217; |&#8221;);<br />while ($line = <output>) {<br />        print $line;<br />} <br />close (OUTPUT); <br />exit 0;<br /></output></code><br />I saved this as <code>/usr/local/scripts/ibrix_quota.pl</code><br />Let&#8217;s make sure this script actually produces something&#8230;</p>
	<p><code><br /># [root@fusionmgr# /usr/local/scripts/ibrix_quota.pl ibrixfs1<br />  ibrixfs1   34518   0              930816      930816     none            0                122945536     122945536     none             <br />  ibrixfs1   34630   102993         930816      930816     none            76309            122945536     122945536     none             <br />  ibrixfs1   34851   0              930816      930816     none            0                122945536     122945536     none             <br />  ibrixfs1   34152   146926         930816      930816     none            14997            122945536     122945536     none             <br />  ibrixfs1   34215   0              930816      930816     none            0                122945536     122945536     none             <br />  ibrixfs1   34234   1055           930816      930816     none            164              122945536     122945536     none             <br />  ibrixfs1   34290   10879          930816      930816     none            10998            122945536     122945536     none             <br />  ibrixfs1   34358   0              930816      930816     none            0                122945536     122945536     none             <br /></code></p>
	</li>

<li>Edit the snmpd.conf file and configure the <strong><em>extend</em></strong> functionality. If your organization/company has a reserved OID, then you can use an open child of that OID, or else, snmp will use the preset MIB tables (<span style="font-style: italic;">nsExtendConfigTable</span>) to store the output. </p>
	<p>There are <span style="font-style: italic;">TWO</span> result tables, in either case. 
<ol> 
<li>nsExtendOutput1Table contains: <br /> 
<ol> 
<li>NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.&#8221;program name&#8221; - <em>First Line of the output</em>          </li>
<br /> 
<li>NET-SNMP-EXTEND-MIB::nsExtendOutputFull.&#8221;program name&#8221; - <em>FULL output</em>          </li>
<br /> 
<li>NET-SNMP-EXTEND-MIB::nsExtendOutNumLines.&#8221;program name&#8221; - <em> Total # of lines in the output</em></li>
<br /> 
<li>NET-SNMP-EXTEND-MIB::nsExtendResult.&#8221;program name&#8221; - <em>Exit Status</em></li>
         </ol>
   </li>
<br /> 
<li>nsExtendOutput2Table contains the output as a series of separate lines</li>
</ol>
	<p>In this case, we will not specify an OID and used the nsExtendOutput tables</p>
	<p><code><br /># echo &#8220;extend ibrix_quota.pl  /usr/local/scripts/ibrix_quota.pl ibrixfs1&#8243; &gt;&gt;  /etc/snmp/snmpd.conf<br /># /etc/init.d/snmpd restart<br /></code></p>
	<p>On the fusion manager, run this snmpwalk command to ensure that the snmp extend functionality is working:</p>
	<p><code><br /># snmpwalk -v1 -c public fusionmgr nsExtendOutput1Table</p>
	<p>NET-SNMP-EXTEND-MIB::nsExtendOutput1Line.&#8221;ibrix_quota.pl&#8221; = STRING:   ibrixfs1   34518   0              930816      930816     none            0                122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutputFull.&#8221;ibrix_quota.pl&#8221; = STRING:   ibrixfs1   34518   0              930816      930816     none            0                122945536     122945536     none             <br />  ibrixfs1   34630   102993         930816      930816     none            76309            122945536     122945536     none             <br />  ibrixfs1   34851   0              930816      930816     none            0                122945536     122945536     none             <br />  ibrixfs1   34152   146926         930816      930816     none            14997            122945536     122945536     none             <br />  ibrixfs1   34215   0              930816      930816     none            0                122945536     122945536     none             <br />  ibrixfs1   34234   1055           930816      930816     none            164              122945536     122945536     none             <br />  ibrixfs1   34290   10879          930816      930816     none            10998            122945536     122945536     none             <br />  ibrixfs1   34358   0              930816      930816     none            0                122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutNumLines.&#8221;ibrix_quota.pl&#8221; = INTEGER: 8<br />NET-SNMP-EXTEND-MIB::nsExtendResult.&#8221;ibrix_quota.pl&#8221; = INTEGER: 0<br /></code> </p>
	<p>Let&#8217;s look at the other output table as well. This time, I am doing it from a remote host also..<br /><code><br />dude@remotehost % snmpwalk -v 1 -c public fusionmgr nsExtendOutput2Table<br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.1 = STRING:   ibrixfs1   34518   0              930816      930816     none            0                122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.2 = STRING:   ibrixfs1   34630   102993         930816      930816     none            76309            122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.3 = STRING:   ibrixfs1   34851   0              930816      930816     none            0                122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.4 = STRING:   ibrixfs1   34152   146926         930816      930816     none            14997            122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.5 = STRING:   ibrixfs1   34215   0              930816      930816     none            0                122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.6 = STRING:   ibrixfs1   34234   1055           930816      930816     none            164              122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.7 = STRING:   ibrixfs1   34290   10879          930816      930816     none            10998            122945536     122945536     none             <br />NET-SNMP-EXTEND-MIB::nsExtendOutLine.&#8221;ibrix_quota.pl&#8221;.8 = STRING:   ibrixfs1   34358   0              930816      930816     none            0                122945536     122945536     none  </p>
	<p></code><br />yay!</p>
	<p>Now you can wrap this snmp command in any script/utility and allow your users lookup their user quota information!</p>
	</li>
</ol>
	<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/ibrix" rel="tag">ibrix</a>, <a class="performancingtags" href="http://technorati.com/tag/quotas" rel="tag">quotas</a>, <a class="performancingtags" href="http://technorati.com/tag/snmp" rel="tag">snmp</a>, <a class="performancingtags" href="http://technorati.com/tag/IANA" rel="tag">IANA</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://rajeev.blogsome.com/2007/03/04/user-quotas/feed/</wfw:commentRss>
	</item>
		<item>
		<title>tables in the post</title>
		<link>http://rajeev.blogsome.com/2006/10/10/tables-in-the-post/</link>
		<comments>http://rajeev.blogsome.com/2006/10/10/tables-in-the-post/#comments</comments>
		<pubDate>Tue, 10 Oct 2006 22:24:54 +0000</pubDate>
		<dc:creator>rajeev</dc:creator>
		
	<category>default</category>
	<category>Asides</category>
		<guid>http://rajeev.blogsome.com/2006/10/10/tables-in-the-post/</guid>
		<description><![CDATA[	
	Vegetable prices in Darwin and Hobart
	
	
	
	Beans
	Peas
	Carrots
	Tomatoes
	
	
	
	
	Darwin
	
	
	Wholesale
	$1.00
	$1.25
	$1.20
	$1.00
	
	
	Retail
	$2.00
	$3.00
	$1.80
	$1.60
	
	
	Hobart
	
	
	Wholesale
	$1.20
	$1.30
	$1.00
	$0.80
	
	
	Retail
	$1.60
	$2.00
	$2.00
	$1.50
	
	
	
]]></description>
			<content:encoded><![CDATA[	<table border="1" summary="Wholesale and retail prices of imported and domestic Vegetables in Darwin and Hobart. There are two levels of column headings.">
	<caption>Vegetable prices in Darwin and Hobart</caption>
	<thead>
	<tr>
	<td></td>
	<th id="beans">Beans</th>
	<th id="peas">Peas</th>
	<th id="carrots">Carrots</th>
	<th id="tomatoes">Tomatoes</th>
	</tr>
	</thead>
	<tbody>
	<tr>
	<th id="darwin" colspan="5">Darwin</th>
	</tr>
	<tr>
	<th headers="darwin" id="wholesale-darwin">Wholesale</th>
	<td headers="beans darwin wholesale-darwin">$1.00</td>
	<td headers="peas darwin wholesale-darwin">$1.25</td>
	<td headers="carrots darwin wholesale-darwin">$1.20</td>
	<td headers="tomatoes darwin wholesale-darwin">$1.00</td>
	</tr>
	<tr>
	<th headers="darwin" id="retail-darwin">Retail</th>
	<td headers="beans darwin retail-darwin">$2.00</td>
	<td headers="peas darwin retail-darwin">$3.00</td>
	<td headers="carrots darwin retail-darwin">$1.80</td>
	<td headers="tomatoes darwin retail-darwin">$1.60</td>
	</tr>
	<tr>
	<th id="hobart" colspan="5">Hobart</th>
	</tr>
	<tr>
	<th headers="hobart" id="wholesale-hobart">Wholesale</th>
	<td headers="beans hobart wholesale-hobart">$1.20</td>
	<td headers="peas hobart wholesale-hobart">$1.30</td>
	<td headers="carrots hobart wholesale-hobart">$1.00</td>
	<td headers="tomatoes hobart wholesale-hobart">$0.80</td>
	</tr>
	<tr>
	<th headers="hobart" id="retail-hobart">Retail</th>
	<td headers="beans hobart retail-hobart">$1.60</td>
	<td headers="peas hobart retail-hobart">$2.00</td>
	<td headers="carrots hobart retail-hobart">$2.00</td>
	<td headers="tomatoes hobart retail-hobart">$1.50</td>
	</tr>
	</tbody>
	</table>
]]></content:encoded>
			<wfw:commentRss>http://rajeev.blogsome.com/2006/10/10/tables-in-the-post/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
