Monitoring Apache Solr
Join the DZone community and get the full member experience.
Join For Free
apache solr
is an open source enterprise search service from the lucene project. solr is written in java and runs as a standalone full-text search server within a servlet container such as tomcat.
like any service or component in your architecture, you’ll want to monitor it to ensure that it’s available and gather performance data to help with tuning.
in this post, we’ll look at how we can monitor solr, what performance metrics we might want to gather and how we can easily achieve this with opsview .
we’ll use opsview as it is built on nagios and thus has access to a wide range of plugins, yet provides a more approachable user interface for configuring service checks.
a check list for service checks
solr is built on lucene so follows the same layout, an index contains documents that are comprised of fields. as part of the search service value add over lucene, solr provides a number of useful ways of obtaining health status / monitoring metrics:
- health-check status using the /admin/ping handler
- the admin statistics page /admin/stats.jsp (xml styled with xsl)
-
jmx mbeans
the list of applicable checks could be defined by whether it is a health check or a data gathering check – but we’d end up with a lot of overlap. instead i’ve divided the list into the checks that can be performed remotely (without an installed agent on the server) and those that are best performed locally to the solr server.
remote (agent-less) checks
what should we look for over the network?
firstly we can have a host-level check which may perform a network level ping.
next we can check tcp connectivity to the servlet container port and then make an http get request to the solr ‘front page’ and check for a known string (e.g.
welcome to solr
).
now we’ve made it up to the application layer so can start to perform solr specific checks. items to monitor may include (delete as applicable):
- ping status
- number of docs
- number of queries / queries per second
- average response time
- number of updates
- cache hit ratios
- replication status
-
synthetic queries
agent-based checks
installing an opsview agent on the solr server means we can run additional checks over nrpe (nagios remote plugin executor). this could be operating system level checks such as memory/disk utilisation or cpu load, or the following:
- java servlet container process is running
- jmx checks e.g. heap memory or custom mbeans
- file age
-
log parsing for exceptions
for more detail on some of the non-solr specific checks, see my previous post on monitoring grails (though broadly applicable to any jvm application).
the solr wiki describes how to configure jmx support: http://wiki.apache.org/solr/solrjmx .
opsview configuration
the rest of the article assumes that you’ve got opsview (or the opsview vmware appliance ) installed & have completed the quick start .
solr-specific plugin
we’ll install the plugin from https://github.com/rbramley/opsview-solr-checks into /usr/local/nagios/libexec/
the check_solr plugin was developed using perl, so that it could be contributed back to opsview (and it would have used nagios::plugin had i known about it sooner). it requires the cpan xml::xpath module ( sudo cpan -i xml::xpath ).
the plugin includes usage instructions,
check_solr -h
which can also be viewed in opsview by selecting the ‘
show plugin help
‘ link beneath the
plugin
drop down (see figure 1).
the
-u
option can be used to specify the url path for multi-core set-ups.
service check setup
figure 1 gives an example of a service check configuration.
figure 2 shows the
agentless
service check group with plugins and their arguments.
host configuration
figure 3 shows a simplistic host setup with a ping check.
figure 4 is an extract from the
monitors
tab, where we select the checks we want performed for the current host.
viewing output
the check results shown in figure 5 are visible by navigating through the host group hierarchy.
if you click on the graph icon of
solr cache hit ratios
this will drill down onto the graph shown in figure 6.
clicking on the graph icon for
solr avg response time – standard
will take you to the graphs in figure 7.
if you shutdown solr, then the check results will start to turn critical and show in red as per figure 8.
alternatives
of course i’m not the first person who’s wanted to monitor solr from opsview or a nagios system, so there are a few plugins available – although the ones i found didn’t meet my personal needs (am happy to share my more detailed assessment notes if there is interest).
- http://code.google.com/p/nagios-plugins-shamil/ – provides ping, replication status and num docs
-
http://code.google.com/p/solr-nagios-check/ – provides qps, response time and num docs
also, chapter 8 of the recently published
apache solr 3 enterprise search server
book includes a section on monitoring solr performance.
summary
using check_solr in conjunction with opsview allows you to ensure that your solr server is available and provides you with metrics that can help you tune your solr configuration. this can be complemented with additional agent-based operating system and jmx checks to give you a full picture view.
hopefully check_solr and the demonstrated agentless service checks will soon be incorporated into opsview to join my check_hudson_job contribution.
source:
http://leanjavaengineering.wordpress.com/2011/12/07/monitoring-apache-solr/
Opinions expressed by DZone contributors are their own.
Trending
-
Microservices Decoded: Unraveling the Benefits, Challenges, and Best Practices for APIs
-
Design Patterns for Microservices: Ambassador, Anti-Corruption Layer, and Backends for Frontends
-
How To Check IP Addresses for Known Threats and Tor Exit Node Servers in Java
-
Auditing Tools for Kubernetes
Comments