Page 2 of 2
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 1:37 pm
by gmills
Nagios Screen Shot
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 2:48 pm
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$"'
}
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 2:58 pm
by gmills
Hi lmiltchev
I've attached the screen shot. thanks again
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 3:08 pm
by lmiltchev
Have you tried wrapping the user macro in double quotes?
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 3:14 pm
by gmills
actually yes, I tried double and single quotes
NRPE is still seeing the splat ! as a field delimiter ????
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 3:31 pm
by lmiltchev
How is "check_remote_container_broker_health" defined on the remote box?
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 3:46 pm
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?
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 3:59 pm
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.
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 4:43 pm
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$'
Re: having trouble using strings on return
Posted: Mon Jul 15, 2019 4:50 pm
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.