You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2009/07/07 20:27:53 UTC

[Solr Wiki] Update of "SolrSnmp" by HossMan

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by HossMan:
http://wiki.apache.org/solr/SolrSnmp

The comment on the change is:
table of contents and header balancing

------------------------------------------------------------------------------
- == SNMP Monitoring of Solr Statistics (through JBoss) ==
+ = SNMP Monitoring of Solr Statistics (through JBoss) =
+ 
+ [[TableOfContents()]]
  
  There are likely several ways of doing this, including finding some libraries (open source or otherwise) that expose MBean attributes through SNMP. However, one of the easiest methods is to use the snmp-adapter.sar that comes with JBoss 4.0.5.GA and above. This page shows how to add an SNMP-adapter that exposes one attribute, the "standard" QueryHandler's request count.
  
- === Setup ===
+ = Setup =
  
  The snmp-adapter.sar can be found in the server/all/deploy directory. You'll want to copy it into your server instance's deploy directory.
  
- ==== Private Enterprise Number (OID) ====
+ == Private Enterprise Number (OID) ==
  
  In order to use SNMP monitoring, you will need to have your own Private Enterprise Number (OID). You can apply for one [http://pen.iana.org/pen/PenApplication.page at IANA's website], and if it's approved it will show up in the [http://www.iana.org/assignments/enterprise-numbers IANA's master list].
  
- ==== Configuring the exposed attributes ====
+ == Configuring the exposed attributes ==
  
  Using your OID (let's say it's 12345678 for XYZ Corp.), you'll want to edit the attributes.xml included in the snmp-adapter.sar to add something like the following:
  {{{
@@ -21, +23 @@

  </mbean>
  }}}
  
- === Creating the MBean ===
+ = Creating the MBean =
  
  You'll want to create an MBean interface that looks something like this:
  {{{
@@ -84, +86 @@

  
  Note that I've stripped out the imports and a bunch of exception-handling code in order to keep this code section as brief as possible, and names have been changed to protect the innocent. You'll want to handle potential null returns, etc.
  
- === Initializing and Registering the MBean ===
+ = Initializing and Registering the MBean =
  
  Solr uses a filter to direct its traffic (SolrDispatchFilter), and inside that filter is a member variable that contains the Solr cores (of type org.apache.solr.core.CoreContainer). Because that member variable is not exposed in any way, you'll have to extend the filter in order to get to the CoreContainer. You should end up with code that looks like this:
  {{{
@@ -142, +144 @@

  </filter>
  }}}
  
- === Testing the exposed SNMP attributes ===
+ = Testing the exposed SNMP attributes =
  
  Once that's done, simply deploy your new war file into JBoss and start it up. A good way to test SNMP locally is by using [http://www.net-snmp.org/ NET-SNMP]. With that installed, you can run commands like this:
  {{{
@@ -154, +156 @@

  SNMPv2-SMI::enterprises.12345678.1.1 = Gauge32: 4
  }}}
  
- === Troubleshooting ===
+ = Troubleshooting =
  
  One problem I've noticed with the SNMP adapter SAR is that although it seems to be able to figure out how to expose "String" and "long" types properly, it does not expose "double" types properly (and it gives no errors about them either, which is troublesome). That means that attributes such as the standard query-handler's avgTimePerRequest statistic should probably be exposed as Strings. Of course, if you can get the double values working, please feel free to edit this wiki and enlighten us all.