You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dmitri Maziuk <dm...@gmail.com> on 2020/12/28 20:36:30 UTC

how to check num found

Hi all,

we're doing periodic database reloads from external sources and I'm 
trying to figure out how to monitor for errors. E.g. I'd run a query 
'?q=FOO:BAR&rows=0' and check if "numFound" > 0, that'd tell me if the 
reload succeeded.

The check is done using nagios curl plugin, and while it can match a 
string in the response, the "> 0" check would require writing an extra 
parser -- it's a simple enough two-liner, but I'd rather not add more 
moving pieces if I can help it.

The best I can figure so far is
```
fl=result:if(gt(docfreq(FOO,BAR),0)"YES","NO")&rows=1
```
-- returns '"result":"NO"' that our nagios plugin can look for.

Is there a better/simpler way?

TIA
Dima

Re: how to check num found

Posted by Dmitri Maziuk <dm...@gmail.com>.
On 1/4/2021 11:25 AM, Chris Hostetter wrote:
> 
> Can't you just configure nagios to do a "negative match" against
> numFound=0 ? ... ie: "if response matches 'numFound=0' fail the check."
> 
> (IIRC there's an '--invert-regex' option for this)

Nothing's ever simple: apparently the standard plugin does not want to 
talk ssl to our iis so they are not using it, they're using curl_http 
instead. Which of course does not have that option.

;)
Dima

Re: how to check num found

Posted by Chris Hostetter <ho...@fucit.org>.
Can't you just configure nagios to do a "negative match" against 
numFound=0 ? ... ie: "if response matches 'numFound=0' fail the check."

(IIRC there's an '--invert-regex' option for this)

: Date: Mon, 28 Dec 2020 14:36:30 -0600
: From: Dmitri Maziuk <dm...@gmail.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: how to check num found
: 
: Hi all,
: 
: we're doing periodic database reloads from external sources and I'm trying to
: figure out how to monitor for errors. E.g. I'd run a query '?q=FOO:BAR&rows=0'
: and check if "numFound" > 0, that'd tell me if the reload succeeded.
: 
: The check is done using nagios curl plugin, and while it can match a string in
: the response, the "> 0" check would require writing an extra parser -- it's a
: simple enough two-liner, but I'd rather not add more moving pieces if I can
: help it.
: 
: The best I can figure so far is
: ```
: fl=result:if(gt(docfreq(FOO,BAR),0)"YES","NO")&rows=1
: ```
: -- returns '"result":"NO"' that our nagios plugin can look for.
: 
: Is there a better/simpler way?
: 
: TIA
: Dima
: 

-Hoss
http://www.lucidworks.com/