having trouble using strings on return

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: having trouble using strings on return

Post by gmills »

Nagios Screen Shot
Attachments
Nagios UI Pic
Nagios UI Pic
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: having trouble using strings on return

Post by lmiltchev »

Hmm, can you try wrapping the user macro in double quotes in the service definition to see if this is going to fix the issue?

Code: Select all

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical "$USER3$"'
        }
Be sure to check out our Knowledgebase for helpful articles and solutions!
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: having trouble using strings on return

Post by gmills »

Hi lmiltchev
I've attached the screen shot. thanks again
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: having trouble using strings on return

Post by lmiltchev »

Have you tried wrapping the user macro in double quotes?
Be sure to check out our Knowledgebase for helpful articles and solutions!
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: having trouble using strings on return

Post by gmills »

actually yes, I tried double and single quotes :)

NRPE is still seeing the splat ! as a field delimiter ????
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: having trouble using strings on return

Post by lmiltchev »

How is "check_remote_container_broker_health" defined on the remote box?
Be sure to check out our Knowledgebase for helpful articles and solutions!
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: having trouble using strings on return

Post by gmills »

Code: Select all

command[check_remote_container_broker_health]=/usr/local/nagios/libexec/check_jmx4perl $ARG1$ $ARG2$
[1563223708] Running command: /usr/local/nagios/libexec/check_jmx4perl --user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical 'Good'
[1563223708] Command completed with return code 2 and output: CRITICAL - [org.apache.activemq:type=Broker,brokerName=amq,service=Health,CurrentStatus] : 'Good' matches threshold 'Good'
[1563223708] Return Code: 2, Output: CRITICAL - [org.apache.activemq:type=Broker,brokerName=amq,service=Health,CurrentStatus] : 'Good' matches threshold 'Good'

Question, does the NRPE system need to be compiled or built with some option to allow this to take place?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: having trouble using strings on return

Post by lmiltchev »

OK, try this:

1. Modify your command to look like this:

Code: Select all

command[check_remote_container_broker_health]=/usr/local/nagios/libexec/check_jmx4perl $ARG1$ '!$ARG2$'
Save, exit, and restart NRPE (or xinetd, depending on how you are running NRPE) so that changes can take effect.

2. In your service, pass everything in $ARG1$, but "Good". Pass "Good" in $ARG2$. Don't pass "!Good" - the "!" is already in $ARG2$ on the remote box.

This *should* work, at least it worked for us in-house.
Be sure to check out our Knowledgebase for helpful articles and solutions!
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: having trouble using strings on return

Post by gmills »

lmiltchev

well, I be.. that worked. tricks of the trade, still leaning. thank you so much!!!

Code: Select all

define command{
        command_name    check_remote_container_broker_health
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$
        }

Code: Select all

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a "--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
        }
NRPE Server

Code: Select all

command[check_remote_container_broker_health]=/usr/local/nagios/libexec/check_jmx4perl $ARG1$ '!$ARG2$'
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: having trouble using strings on return

Post by lmiltchev »

well, I be.. that worked. tricks of the trade, still leaning. thank you so much!!!
I am glad I was able to help! :)

I am closing this topic now. If you have any further questions, please start a new thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked