I have the following command I want to run on several remote servers using NRPE. Something similar to the following:
command[check_http_json-int]=/usr/lib64/nagios/plugins/check_http_json --user administrator --pass foopass -u http://<some_url>.flagstar.com:4502/system/sling/monitoring/mbeans/java/lang/Memory.infinity.json -e {noname}.mbean:attributes.HeapMemoryUsage.mbean:attributes.used.mbean:value -w 1000000000 -c 3000000000
Of course, each server has different settings. The variables I want to set are:
_JSON_USER
_JSON_PW
_JSON_URL
_JSON_ELEMENT
_JSON_WARN
_JSON_CRIT
I know this is incorrect, but I imagine the configuration would look something like (assuming I can set soome Free Variables on the Host?):
command[check_http_json-int]=/usr/lib64/nagios/plugins/check_http_json --user $JSON_USER --pass $JSON_PW -u $JSON_URL -e $JSON_ELEMENT -w $JSON_WANR -c $JSON_CRITICAL
Is there some documentation you can direct me to how to use pass some variables to a remote host? I'm not having much luck finding much.
Using NRPE to execute command with variables
Re: Using NRPE to execute command with variables
Please see here:
Basically you can run:
Then just set them up in the command:
Code: Select all
https://assets.nagios.com/downloads/nagiosxi/docs/Monitoring_Hosts_Using_NRPE.pdfCode: Select all
/usr/local/nagios/libexec/check_nrpe -H 192.168.232.22 -c check_http_json-int -a JSON_USER JSON_PW JSON_URL JSON_ELEMENT JSON_WARN JSON_CRITICAL
/usr/local/nagios/libexec/check_nrpe -H 192.168.232.22 -c check_http_json-int -a dave davespw www91 unsurewhatthisis 1000000000 3000000000Code: Select all
command[check_http_json-int]=/usr/lib64/nagios/plugins/check_http_json --user '$ARG1$' --pass '$ARG2$' -u http://$ARG3$.flagstar.com:4502/system/sling/monitoring/mbeans/java/lang/Memory.infinity.json -e {noname}.mbean:attributes.HeapMemoryUsage.mbean:attributes.used.mbean:value -w $ARG5$ -c $ARG6$Re: Using NRPE to execute command with variables
Thank you for the reply.
I was pushing some variables using something similar to:
Then setting up the command similar to:
It worked as expected. I had nasty characters {}/ which I had to tweak, but otherwise it worked.
Thanks
I was pushing some variables using something similar to:
Code: Select all
command[check_http_json-int]=/usr/lib64/nagios/plugins/check_http_json --user '$ARG1$' --pass '$ARG2$' -u http://$ARG3$.flagstar.com:4502/system/sling/monitoring/mbeans/java/lang/Memory.infinity.json -e {noname}.mbean:attributes.HeapMemoryUsage.mbean:attributes.used.mbean:value -w $ARG5$ -c $ARG6$Code: Select all
command[check_http_json-int]=/usr/lib64/nagios/plugins/check_http_json --user '$ARG1$' --pass '$ARG2$' -u http://$ARG3$.flagstar.com:4502/system/sling/monitoring/mbeans/java/lang/Memory.infinity.json -e {noname}.mbean:attributes.HeapMemoryUsage.mbean:attributes.used.mbean:value -w $ARG5$ -c $ARG6$Thanks
Re: Using NRPE to execute command with variables
Hi fsbeaunix,
It looks like you posted the same thing twice but had some success. Can you confirm and let us know if this thread can be locked?
It looks like you posted the same thing twice but had some success. Can you confirm and let us know if this thread can be locked?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Using NRPE to execute command with variables
Yes, this thread can be locked.
My two takeaways were a) I was using incorrect syntax for the check_nrpe command, and b) the awareness of the NRPE "Nasty Characters" {}\/
Thanks
My two takeaways were a) I was using incorrect syntax for the check_nrpe command, and b) the awareness of the NRPE "Nasty Characters" {}\/
Thanks